diff options
author | Mihnea Dobrescu-Balaur <mihneadb@gmail.com> | 2013-03-11 12:23:36 +0100 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-03-18 21:31:31 +0100 |
commit | 29d0b218c87ace1078e08bb32c2e72fc96fa3db3 (patch) | |
tree | 439d33d7c607ecca5410754117438f82458a2696 /drivers | |
parent | xen-blkback: fix dispatch_rw_block_io() error path (diff) | |
download | linux-29d0b218c87ace1078e08bb32c2e72fc96fa3db3.tar.xz linux-29d0b218c87ace1078e08bb32c2e72fc96fa3db3.zip |
xen-blkfront: replace kmalloc and then memcpy with kmemdup
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/xen-blkfront.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index c3dae2e0f290..962064487ef7 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -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)); |