[PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
jengelh at computergmbh.de
Sun Aug 26 10:37:13 EDT 2007
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.
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
More information about the linux-mtd