Commit 749f3c05 authored by Shraddha Barke's avatar Shraddha Barke Committed by Greg Kroah-Hartman

Staging: rtl8192e: Use kcalloc instead of kzalloc to allocate array

The advantage of kcalloc is, that will prevent integer overflows which
could result from the multiplication of number of elements and size and
it is also a bit nicer to read.
Signed-off-by: default avatarShraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41cb5786
...@@ -59,9 +59,8 @@ static inline int rtllib_networks_allocate(struct rtllib_device *ieee) ...@@ -59,9 +59,8 @@ static inline int rtllib_networks_allocate(struct rtllib_device *ieee)
if (ieee->networks) if (ieee->networks)
return 0; return 0;
ieee->networks = kzalloc( ieee->networks = kcalloc(MAX_NETWORK_COUNT,
MAX_NETWORK_COUNT * sizeof(struct rtllib_network), sizeof(struct rtllib_network), GFP_KERNEL);
GFP_KERNEL);
if (!ieee->networks) if (!ieee->networks)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment