Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions

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

 




On 29/08/2016 13:57, walter harms wrote:
> > > -	buf = kmalloc(sizeof(char) * (count + 1), GFP_KERNEL);
> > > +	buf = kmalloc_array(count + 1, sizeof(*buf), GFP_KERNEL);
> > >  	if (!buf)
> > >  		return -ENOMEM;
> > >  
> > 
> > Here it's probably best to just remove sizeof(char) completely, as it's
> > 1 by definition.
> 
> I would not do so, if you ever change buf to something else it would break,
> having a sizeof(*buf) here is harmless and a known pattern.

Fair enough, it's not code I maintain.

Paolo
--
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