diff options
author | Wan Jiabing <wanjiabing@vivo.com> | 2021-10-13 09:34:41 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2021-10-18 14:35:24 +0300 |
commit | 260aecd643fc129c1771cefdd2aaaedf0485fa59 (patch) | |
tree | c0feabc5a34a56e73783ea3c737062891b8092e1 /drivers/iommu | |
parent | 9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff) | |
download | linux-260aecd643fc129c1771cefdd2aaaedf0485fa59.tar.xz |
iommu/dart: Use kmemdup instead of kzalloc and memcpy
Fix following coccicheck warning:
drivers/iommu/apple-dart.c:704:20-27: WARNING opportunity for kmemdup
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Acked-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Link: https://lore.kernel.org/r/20211013063441.29888-1-wanjiabing@vivo.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/apple-dart.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index fdfa39ec2a4d..13ba258b7413 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -702,13 +702,12 @@ static struct iommu_group *apple_dart_device_group(struct device *dev) if (!group) goto out; - group_master_cfg = kzalloc(sizeof(*group_master_cfg), GFP_KERNEL); + group_master_cfg = kmemdup(cfg, sizeof(*group_master_cfg), GFP_KERNEL); if (!group_master_cfg) { iommu_group_put(group); goto out; } - memcpy(group_master_cfg, cfg, sizeof(*group_master_cfg)); iommu_group_set_iommudata(group, group_master_cfg, apple_dart_release_group); |