[PATCH] device-mapper dm-emc: Fix a memset

From: Alasdair G Kergon
Date: Wed May 04 2005 - 12:32:34 EST


The dm emc hardware handler code memset the hardware handler
structure to zero AFTER it had initialized the structure's
spinlock field.

Signed-Off-By: Alasdair G Kergon <agk@xxxxxxxxxx>
From: Dave Olien <dmo@xxxxxxxx>

--- diff/drivers/md/dm-emc.c 2005-04-21 18:48:40.000000000 +0100
+++ source/drivers/md/dm-emc.c 2005-04-21 18:48:29.000000000 +0100
@@ -223,8 +223,10 @@
{
struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL);

- if (h)
+ if (h) {
+ memset(h, 0, sizeof(*h));
spin_lock_init(&h->lock);
+ }

return h;
}
@@ -259,8 +261,6 @@
if (!h)
return -ENOMEM;

- memset(h, 0, sizeof(*h));
-
hwh->context = h;

if ((h->short_trespass = short_trespass))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/