[PATCH v3] drm/amdgpu: Fix the memory allocation issue in amdgpu_discovery_get_nps_info()

Markus Elfring Markus.Elfring at web.de
Tue Oct 29 19:43:28 UTC 2024


…
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -1757,11 +1757,13 @@ int amdgpu_discovery_get_nps_info(struct amdgpu_device *adev,
>
>  	switch (le16_to_cpu(nps_info->v1.header.version_major)) {
>  	case 1:
> +		mem_ranges = kvcalloc(nps_info->v1.count,
> +				      sizeof(struct amdgpu_gmc_memrange),
> +				      GFP_KERNEL);
…

Can the specification “sizeof(*mem_ranges)” be more appropriate here?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.12-rc5#n941

Regards,
Markus


More information about the dri-devel mailing list