[PATCH] device-mapper dm-emc: Fix a memset
authorAlasdair G Kergon <agk@redhat.com>
Thu, 5 May 2005 23:16:08 +0000 (16:16 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 5 May 2005 23:36:46 +0000 (16:36 -0700)
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@redhat.com>
From: Dave Olien <dmo@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-emc.c

index 7006586645943b81d6b21bd7281b88380c62201a..c7067674dcb77ca8d1a2e4ee51f032a2bfb9aac8 100644 (file)
@@ -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))