提交 60abc786 编写于 作者: M Mihnea Dobrescu-Balaur 提交者: Linus Torvalds

aoe: replace kmalloc and then memcpy with kmemdup

Signed-off-by: NMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Cc: Ed Cashin <ecashin@coraid.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 078be02b
...@@ -139,13 +139,12 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags); ...@@ -139,13 +139,12 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
return; return;
} }
mp = kmalloc(n, GFP_ATOMIC); mp = kmemdup(msg, n, GFP_ATOMIC);
if (mp == NULL) { if (mp == NULL) {
printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n); printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
goto bail; goto bail;
} }
memcpy(mp, msg, n);
em->msg = mp; em->msg = mp;
em->flags |= EMFL_VALID; em->flags |= EMFL_VALID;
em->len = n; em->len = n;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册