aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2014-11-14 13:36:42 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-16 14:41:39 -0500
commit5bc4b46a70eab74d642c726d99433166d3f65e45 (patch)
treee3f0c57d4f8a3f5299d1eaeae9644f8e7e516f9d
parentf35423c137b0e64155f52c166db1d13834a551f2 (diff)
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>
-rw-r--r--net/dsa/dsa.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 4648f12098ad..c00cca3e1913 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -526,7 +526,8 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
526 526
527 /* First time routing table allocation */ 527 /* First time routing table allocation */
528 if (!cd->rtable) { 528 if (!cd->rtable) {
529 cd->rtable = kmalloc(pd->nr_chips * sizeof(s8), GFP_KERNEL); 529 cd->rtable = kmalloc_array(pd->nr_chips, sizeof(s8),
530 GFP_KERNEL);
530 if (!cd->rtable) 531 if (!cd->rtable)
531 return -ENOMEM; 532 return -ENOMEM;
532 533