From: Alasdair G Kergon Date: Thu, 5 May 2005 23:16:08 +0000 (-0700) Subject: [PATCH] device-mapper dm-emc: Fix a memset X-Git-Tag: v2.6.12-rc4~47 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1daa40b638891a62e1be40f78d752c500265362;p=linux-2.6 [PATCH] device-mapper dm-emc: Fix a memset 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 From: Dave Olien Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c index 7006586645..c7067674dc 100644 --- a/drivers/md/dm-emc.c +++ b/drivers/md/dm-emc.c @@ -223,8 +223,10 @@ static struct emc_handler *alloc_emc_handler(void) { 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 @@ static int emc_create(struct hw_handler *hwh, unsigned argc, char **argv) if (!h) return -ENOMEM; - memset(h, 0, sizeof(*h)); - hwh->context = h; if ((h->short_trespass = short_trespass))