Skip to content

Commit

Permalink
aoe: replace kmalloc and then memcpy with kmemdup
Browse files Browse the repository at this point in the history
Signed-off-by: Mihnea Dobrescu-Balaur <[email protected]>
Cc: Ed Cashin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mihneadb authored and torvalds committed May 1, 2013
1 parent 078be02 commit 60abc78
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/block/aoe/aoechr.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,12 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
return;
}

mp = kmalloc(n, GFP_ATOMIC);
mp = kmemdup(msg, n, GFP_ATOMIC);
if (mp == NULL) {
printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
goto bail;
}

memcpy(mp, msg, n);
em->msg = mp;
em->flags |= EMFL_VALID;
em->len = n;
Expand Down

0 comments on commit 60abc78

Please sign in to comment.