Skip to content

Commit

Permalink
[PATCH] device-mapper dm-emc: Fix a memset
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed May 5, 2005
1 parent c557308 commit f1daa40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/md/dm-emc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit f1daa40

Please sign in to comment.