Skip to content

Commit

Permalink
net: dsa: replace count*size kzalloc by kcalloc
Browse files Browse the repository at this point in the history
kcalloc manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fabian Frederick authored and David S. Miller committed Nov 16, 2014
1 parent 5bc4b46 commit 6f2aed6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6f2aed6

Please sign in to comment.