summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorKai Song <songkai01@inspur.com>2021-10-03 11:06:56 +0300
committerDavid Sterba <dsterba@suse.com>2021-10-26 20:08:05 +0300
commit64259baa396f185cdb44eeb9432fd9b85b178a9a (patch)
tree474526dfade12a39c839c4ccb7405987f80ba9b9 /fs/btrfs
parent0cf9b244e7db173bdb0cffed0253fea808f7f4e6 (diff)
downloadlinux-64259baa396f185cdb44eeb9432fd9b85b178a9a.tar.xz
btrfs: zoned: use kmemdup() to replace kmalloc + memcpy
Fix memdup.cocci warning: fs/btrfs/zoned.c:1198:23-30: WARNING opportunity for kmemdup Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Kai Song <songkai01@inspur.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/zoned.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 14ea6797bf49..67d932d70798 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1195,14 +1195,12 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)
map = em->map_lookup;
- cache->physical_map = kmalloc(map_lookup_size(map->num_stripes), GFP_NOFS);
+ cache->physical_map = kmemdup(map, map_lookup_size(map->num_stripes), GFP_NOFS);
if (!cache->physical_map) {
ret = -ENOMEM;
goto out;
}
- memcpy(cache->physical_map, map, map_lookup_size(map->num_stripes));
-
alloc_offsets = kcalloc(map->num_stripes, sizeof(*alloc_offsets), GFP_NOFS);
if (!alloc_offsets) {
ret = -ENOMEM;