net: dsa: replace count*size kzalloc by kcalloc

kcalloc 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:38:23 +01:00 committed by David S. Miller
parent 5bc4b46a70
commit 6f2aed6ad7

View 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;