Commit 60abc786 authored by Mihnea Dobrescu-Balaur's avatar Mihnea Dobrescu-Balaur Committed by Linus Torvalds

aoe: replace kmalloc and then memcpy with kmemdup

Signed-off-by: default avatarMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Cc: Ed Cashin <ecashin@coraid.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment