Skip to contentSkip to conversation

s2io bogus memset

PATCH Applied Al Viro 2 participants 2 messages Jan 23, 2007 Network drivers

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 s2io bogus memset

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.

---

drivers/net/s2io.c +1 -2
@@ -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;
Applied
#1 lore raw
Quoted 4 lines · Al Viro

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.

applied