From: Fabian Frederick Date: Fri, 14 Nov 2014 18:36:42 +0000 (+0100) Subject: net: dsa: replace count*size kmalloc by kmalloc_array X-Git-Tag: firefly_0821_release~176^2~2717^2~184 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5bc4b46a70eab74d642c726d99433166d3f65e45;p=firefly-linux-kernel-4.4.55.git net: dsa: replace count*size kmalloc by kmalloc_array kmalloc_array manages count*sizeof overflow. Signed-off-by: Fabian Frederick Signed-off-by: David S. Miller --- 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, /* 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;