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

Reply via email to