drm/amd: use kmalloc_array over kmalloc with multiply
Subsystems (3)
PATCH 1/1 drm/amd: use kmalloc_array over kmalloc with multiply
Fix patch check warning:
WARNING: Prefer kmalloc_array over kmalloc with multiply
+ buf = kmalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL);
Signed-off-by Bernard Zhao <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +1 -1
@@ -81,7 +81,7 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char __user *user,struct kfd_smi_client *client = filep->private_data;unsigned char *buf; - buf =kmalloc (MAX_KFIFO_SIZE *sizeof (*buf),GFP_KERNEL ); + buf =kmalloc_array (MAX_KFIFO_SIZE ,sizeof (*buf),GFP_KERNEL );if (!buf)return -ENOMEM ;
Signature · 1 line
2.31.0
Alex Deucher
AppliedApplied. Thanks!
Quoted 26 lines · Bernard Zhao
Fix patch check warning:
WARNING: Preferkmalloc_arrayover kmalloc with multiply
+ buf =kmalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL);Signed-off-by Bernard Zhao <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +1
-2@@ -81,7 +81,7 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char __user *user,struct kfd_smi_client *client = filep->private_data;unsigned char *buf; - buf =kmalloc (MAX_KFIFO_SIZE *sizeof (*buf),GFP_KERNEL ); + buf =kmalloc_array (MAX_KFIFO_SIZE ,sizeof (*buf),GFP_KERNEL );if (!buf)return -ENOMEM ; --2.31.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx