net: dsa: replace count*size kzalloc by kcalloc
authorFabian Frederick <fabf@skynet.be>
Fri, 14 Nov 2014 18:38:23 +0000 (19:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Nov 2014 19:41:39 +0000 (14:41 -0500)
kcalloc manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa.c

index c00cca3e1913a640aba050e45eb449d4dd246c9c..322c778487e7dd5f1276b84334838fb266241807 100644 (file)
@@ -607,8 +607,8 @@ static int dsa_of_probe(struct platform_device *pdev)
        if (pd->nr_chips > DSA_MAX_SWITCHES)
                pd->nr_chips = DSA_MAX_SWITCHES;
 
-       pd->chip = kzalloc(pd->nr_chips * sizeof(struct dsa_chip_data),
-                       GFP_KERNEL);
+       pd->chip = kcalloc(pd->nr_chips, sizeof(struct dsa_chip_data),
+                          GFP_KERNEL);
        if (!pd->chip) {
                ret = -ENOMEM;
                goto out_free;