[PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
jesper.juhl at gmail.com
Sun Aug 26 18:10:17 EDT 2007
On 26/08/07, Jan Engelhardt <jengelh at computergmbh.de> wrote:
> On Aug 26 2007 15:28, Denys Vlasenko wrote:
> >> >
> >> > What exactely would using kcalloc() over kzalloc() here buy us?
> >> technically, nothing.
> >The idea of calloc is that it can check for underflow in parameter.
> Actually, overflow.
> calloc(0xFFFF0000, 0x1000) => will return NULL
> malloc(0xFFFF0000 * 0x1000) => silent 32 bit multiplication/truncation,
> will allocate less than requested.
> >calloc(-1, 10000000) => easy to detect
> >malloc(-1 * 10000000) => malloc(-10000000) => not so trivial
Ok, that makes a bit of sense. Thank you.
Jesper Juhl <jesper.juhl at gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
More information about the linux-mtd