[PATCH] s2io bogus memset
authorAl Viro <viro@ftp.linux.org.uk>
Tue, 23 Jan 2007 12:25:08 +0000 (12:25 +0000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 23 Jan 2007 19:09:49 +0000 (11:09 -0800)
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/net/s2io.c

index 250cdbeefdfde0da0641c999e6af0f0272351aa0..1dd66b8ea0fae545e12b70da9e45a7b01c16d79b 100644 (file)
@@ -556,10 +556,9 @@ static int init_shared_mem(struct s2io_nic *nic)
                }
        }
 
                }
        }
 
-       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;
        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;
 
        /* Allocation and initialization of RXDs in Rings */
        size = 0;