* [PATCH 1/1 net-next] net: dsa: replace count*size kzalloc by kcalloc
@ 2014-11-14 18:38 Fabian Frederick
2014-11-16 19:44 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-11-14 18:38 UTC (permalink / raw)
To: linux-kernel; +Cc: Fabian Frederick, David S. Miller, netdev
kcalloc manages count*sizeof overflow.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
net/dsa/dsa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 4648f12..e84b656 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -606,8 +606,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;
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-16 19:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 18:38 [PATCH 1/1 net-next] net: dsa: replace count*size kzalloc by kcalloc Fabian Frederick
2014-11-16 19:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox