net: dsa: replace count*size kmalloc by kmalloc_array

kmalloc_array manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Fabian Frederick 2014-11-14 19:36:42 +01:00 committed by David S. Miller
parent f35423c137
commit 5bc4b46a70

View file

@ -526,7 +526,8 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
/* First time routing table allocation */
if (!cd->rtable) {
cd->rtable = kmalloc(pd->nr_chips * sizeof(s8), GFP_KERNEL);
cd->rtable = kmalloc_array(pd->nr_chips, sizeof(s8),
GFP_KERNEL);
if (!cd->rtable)
return -ENOMEM;