projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b88539
)
ext4: use kmemdup() to replace kmalloc + memcpy
author
Shuqi Zhang
<zhangshuqi3@huawei.com>
Wed, 25 May 2022 03:01:20 +0000
(11:01 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:27 +0000
(14:24 +0200)
[ Upstream commit
4efd9f0d120c55b08852ee5605dbb02a77089a5d
]
Replace kmalloc + memcpy with kmemdup()
Signed-off-by: Shuqi Zhang <zhangshuqi3@huawei.com>
Reviewed-by: Ritesh Harjani <ritesh.list@gmail.com>
Link:
https://lore.kernel.org/r/20220525030120.803330-1-zhangshuqi3@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/xattr.c
patch
|
blob
|
history
diff --git
a/fs/ext4/xattr.c
b/fs/ext4/xattr.c
index b57fd07fbdbafa4f5401f912f6def08fcf8981f3..d92d50de5a0116c9b0d5daaf2a08efce38671110 100644
(file)
--- a/
fs/ext4/xattr.c
+++ b/
fs/ext4/xattr.c
@@
-1887,11
+1887,10
@@
ext4_xattr_block_set(handle_t *handle, struct inode *inode,
unlock_buffer(bs->bh);
ea_bdebug(bs->bh, "cloning");
- s->base = km
alloc(
bs->bh->b_size, GFP_NOFS);
+ s->base = km
emdup(BHDR(bs->bh),
bs->bh->b_size, GFP_NOFS);
error = -ENOMEM;
if (s->base == NULL)
goto cleanup;
- memcpy(s->base, BHDR(bs->bh), bs->bh->b_size);
s->first = ENTRY(header(s->base)+1);
header(s->base)->h_refcount = cpu_to_le32(1);
s->here = ENTRY(s->base + offset);