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: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Shraddha Barke 2015-10-09 21:03:29 +05:30 коммит произвёл Greg Kroah-Hartman
Родитель 41cb578655
Коммит 749f3c0500
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -59,9 +59,8 @@ static inline int rtllib_networks_allocate(struct rtllib_device *ieee)
if (ieee->networks)
return 0;
ieee->networks = kzalloc(
MAX_NETWORK_COUNT * sizeof(struct rtllib_network),
GFP_KERNEL);
ieee->networks = kcalloc(MAX_NETWORK_COUNT,
sizeof(struct rtllib_network), GFP_KERNEL);
if (!ieee->networks)
return -ENOMEM;