Re: [PATCH v3] staging: rtl8192u: ieee80211: replace kmalloc/memset with kzalloc

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

 



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 <eafanasova@xxxxxxxxx>
> ---
> 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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux