* [PATCH] tcp: correct kcalloc usage
[not found] <for-27-patch8-1@bga.com>
@ 2008-07-10 21:25 ` Milton Miller
2008-07-10 23:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Milton Miller @ 2008-07-10 21:25 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, Andrew Morton
kcalloc is supposed to be called with the count as its first argument and
the element size as the second.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
Both arguments are size_t so does not affect correctness. This
callsite is during module_init and therefore not performance critical.
Another patch will optimize the case when the count is variable but
the size is fixed.
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index 5ff0ce6..7ddc30f 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -224,7 +224,7 @@ static __init int tcpprobe_init(void)
if (bufsize < 0)
return -EINVAL;
- tcp_probe.log = kcalloc(sizeof(struct tcp_log), bufsize, GFP_KERNEL);
+ tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL);
if (!tcp_probe.log)
goto err0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tcp: correct kcalloc usage
2008-07-10 21:25 ` [PATCH] tcp: correct kcalloc usage Milton Miller
@ 2008-07-10 23:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-07-10 23:51 UTC (permalink / raw)
To: miltonm; +Cc: netdev, linux-kernel, akpm
From: Milton Miller <miltonm@bga.com>
Date: Thu, 10 Jul 2008 16:25:33 -0500 (CDT)
> kcalloc is supposed to be called with the count as its first argument and
> the element size as the second.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-10 23:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <for-27-patch8-1@bga.com>
2008-07-10 21:25 ` [PATCH] tcp: correct kcalloc usage Milton Miller
2008-07-10 23:51 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).