linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s2io bogus memset
@ 2007-01-23 12:25 Al Viro
  2007-01-23 21:26 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2007-01-23 12:25 UTC (permalink / raw)
  To: torvalds; +Cc: jgarzik, linux-kernel


memset() after kmalloc() on size * 8 would better be on size * 8, not
just size; fixed by switching to kcalloc() - it's more idiomatic anyway.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -554,10 +554,9 @@ static int init_shared_mem(struct s2io_n
 		}
 	}
 
-	nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL);
+	nic->ufo_in_band_v = kcalloc(size, sizeof(u64), GFP_KERNEL);
 	if (!nic->ufo_in_band_v)
 		return -ENOMEM;
-	memset(nic->ufo_in_band_v, 0, size);
 
 	/* Allocation and initialization of RXDs in Rings */
 	size = 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] s2io bogus memset
  2007-01-23 12:25 [PATCH] s2io bogus memset Al Viro
@ 2007-01-23 21:26 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-01-23 21:26 UTC (permalink / raw)
  To: Al Viro; +Cc: torvalds, linux-kernel

Al Viro wrote:
> memset() after kmalloc() on size * 8 would better be on size * 8, not
> just size; fixed by switching to kcalloc() - it's more idiomatic anyway.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

applied



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-23 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 12:25 [PATCH] s2io bogus memset Al Viro
2007-01-23 21:26 ` Jeff Garzik

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).