Commit f1daa40b authored by Alasdair G Kergon's avatar Alasdair G Kergon Committed by Linus Torvalds

[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: default avatarAlasdair G Kergon <agk@redhat.com>
From: Dave Olien <dmo@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c557308e
...@@ -223,8 +223,10 @@ static struct emc_handler *alloc_emc_handler(void) ...@@ -223,8 +223,10 @@ static struct emc_handler *alloc_emc_handler(void)
{ {
struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL);
if (h) if (h) {
memset(h, 0, sizeof(*h));
spin_lock_init(&h->lock); spin_lock_init(&h->lock);
}
return h; return h;
} }
...@@ -259,8 +261,6 @@ static int emc_create(struct hw_handler *hwh, unsigned argc, char **argv) ...@@ -259,8 +261,6 @@ static int emc_create(struct hw_handler *hwh, unsigned argc, char **argv)
if (!h) if (!h)
return -ENOMEM; return -ENOMEM;
memset(h, 0, sizeof(*h));
hwh->context = h; hwh->context = h;
if ((h->short_trespass = short_trespass)) if ((h->short_trespass = short_trespass))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment