Re: [PATCH] pinctrl: imx: Check for memory allocation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 07, 2017 at 04:40:38AM +0900, Stafford Horne wrote:
> Hi Christophe,
> 
> On Sat, May 06, 2017 at 10:23:59AM +0200, Christophe JAILLET wrote:
> > If 'devm_kzalloc' fails, a NULL pointer will be dereferenced.
> > Return -ENOMEM instead, as done for the other memory allocation just a
> > few lines below.
> 
> This looks fine.
> 
> > BTW, change the 'devm_kzalloc' into a 'devm_kcalloc'.
> 
> Any reason for the devm_kcalloc change?  It looks like the next for loop
> does set all of the group_name values.
> 

The advantage of kcalloc() over kzalloc() is the integer overflow
checking.  There is kmalloc_array() if we don't need to zero the memory.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux