Commit 95666c6c authored by Bernard Zhao's avatar Bernard Zhao Committed by Alex Deucher

amd/amdgpu: use kmalloc_array to replace kmalloc with multiply

Fix check_patch.pl warning:
WARNING: Prefer kmalloc_array over kmalloc with multiply
+bps = kmalloc(align_space * sizeof((*data)->bps), GFP_KERNEL);
WARNING: Prefer kmalloc_array over kmalloc with multiply
+bps_bo = kmalloc(align_space * sizeof((*data)->bps_bo),
GFP_KERNEL);
kmalloc_array has multiply overflow check, which will be safer.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarBernard Zhao <bernard@vivo.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b14a04fe
...@@ -280,8 +280,8 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) ...@@ -280,8 +280,8 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev)
if (!*data) if (!*data)
return -ENOMEM; return -ENOMEM;
bps = kmalloc(align_space * sizeof((*data)->bps), GFP_KERNEL); bps = kmalloc_array(align_space, sizeof((*data)->bps), GFP_KERNEL);
bps_bo = kmalloc(align_space * sizeof((*data)->bps_bo), GFP_KERNEL); bps_bo = kmalloc_array(align_space, sizeof((*data)->bps_bo), GFP_KERNEL);
if (!bps || !bps_bo) { if (!bps || !bps_bo) {
kfree(bps); kfree(bps);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment