On Sun, Oct 25, 2020 at 10:54:31AM -0700, Elena Afanasova wrote:
> Replace kmalloc + memset 0 by a call to kzalloc which zeroes memory too.
> Found with Coccinelle.
> 
> Signed-off-by: Elena Afanasova <eafanas...@gmail.com>
> ---
> Changes in v3:
>         - use array_size()

struct_size() is more correct than array_size().  If there were really
a danger from array overflows then array_size() would not prevent it
100%.

There should probably be a static checker warning for when people do
"expr + array_size()".  If you're looking for something to write, that's
an idea you could implement with Coccinelle or Smatch.

regards,
dan carpenter


_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to