提交 29d0b218 编写于 作者: M Mihnea Dobrescu-Balaur 提交者: Konrad Rzeszutek Wilk

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: NMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
上级 0e5e098a
...@@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info) ...@@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info)
int j; int j;
/* Stage 1: Make a safe copy of the shadow state. */ /* 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); GFP_NOIO | __GFP_REPEAT | __GFP_HIGH);
if (!copy) if (!copy)
return -ENOMEM; return -ENOMEM;
memcpy(copy, info->shadow, sizeof(info->shadow));
/* Stage 2: Set up free list. */ /* Stage 2: Set up free list. */
memset(&info->shadow, 0, sizeof(info->shadow)); memset(&info->shadow, 0, sizeof(info->shadow));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册