Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29d0b218 authored by Mihnea Dobrescu-Balaur's avatar Mihnea Dobrescu-Balaur Committed by Konrad Rzeszutek Wilk
Browse files

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: default avatarMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 0e5e098a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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));