Skip to content

Commit

Permalink
xen-blkfront: replace kmalloc and then memcpy with kmemdup
Browse files Browse the repository at this point in the history
The benefits are:
* code is cleaner
* kmemdup adds additional debugging info useful for tracking the real
place where memory was allocated (CONFIG_DEBUG_SLAB).

Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Mihnea Dobrescu-Balaur authored and Konrad Rzeszutek Wilk committed Mar 18, 2013
1 parent 0e5e098 commit 29d0b21
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info)
int j;

/* Stage 1: Make a safe copy of the shadow state. */
copy = kmalloc(sizeof(info->shadow),
copy = kmemdup(info->shadow, sizeof(info->shadow),
GFP_NOIO | __GFP_REPEAT | __GFP_HIGH);
if (!copy)
return -ENOMEM;
memcpy(copy, info->shadow, sizeof(info->shadow));

/* Stage 2: Set up free list. */
memset(&info->shadow, 0, sizeof(info->shadow));
Expand Down

0 comments on commit 29d0b21

Please sign in to comment.