diff options
| author | Shuqi Zhang <zhangshuqi3@huawei.com> | 2022-05-25 11:01:20 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-17 14:24:27 +0200 |
| commit | 51877de35d218e5183d8a1a8824c50bdcf9c78b6 (patch) | |
| tree | 0c99aede3d6c62a607f906fca338ea87b6d79ebb | |
| parent | 0b885394fd009aa0b46d81b496a816ab11309f8a (diff) | |
| download | linux-51877de35d218e5183d8a1a8824c50bdcf9c78b6.tar.gz linux-51877de35d218e5183d8a1a8824c50bdcf9c78b6.tar.bz2 linux-51877de35d218e5183d8a1a8824c50bdcf9c78b6.zip | |
ext4: use kmemdup() to replace kmalloc + memcpy
[ 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>
| -rw-r--r-- | fs/ext4/xattr.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index b57fd07fbdba..d92d50de5a01 100644 --- 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 = kmalloc(bs->bh->b_size, GFP_NOFS); + s->base = kmemdup(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); |
