Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Use kmalloc_array() in amdgpu_debugfs_gca_config_read()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Markus Elfring and committed by
Alex Deucher
ecab7668 f2cdaf20

+1 -1
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2712 2712 if (size & 0x3 || *pos & 0x3) 2713 2713 return -EINVAL; 2714 2714 2715 - config = kmalloc(256 * sizeof(*config), GFP_KERNEL); 2715 + config = kmalloc_array(256, sizeof(*config), GFP_KERNEL); 2716 2716 if (!config) 2717 2717 return -ENOMEM; 2718 2718