drm/amdgpu: check return value of xa_store()
Subsystems (2)
PATCH 1/1 drm/amdgpu: check return value of xa_store()
xa_store() may fail so check its return value and if error occurred free numa_info and return NULL.
Signed-off-by Salah Triki <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -2
@@ -876,7 +876,7 @@ static inline uint64_t amdgpu_acpi_get_numa_size(int nid)static struct amdgpu_numa_info *amdgpu_acpi_get_numa_info (uint32_t pxm) { -struct amdgpu_numa_info *numa_info; +struct amdgpu_numa_info *numa_info, *old;int nid; numa_info =xa_load (&numa_info_xa, pxm);
@@ -898,7 +898,11 @@ static struct amdgpu_numa_info *amdgpu_acpi_get_numa_info(uint32_t pxm) }else { numa_info->size =amdgpu_acpi_get_numa_size (nid); } -xa_store (&numa_info_xa, numa_info->pxm, numa_info,GFP_KERNEL ); + old =xa_store (&numa_info_xa, numa_info->pxm, numa_info,GFP_KERNEL ); +if (xa_is_err (old)) { +kfree (numa_info); +return NULL ; + } }return numa_info;
Signature · 1 line
2.43.0
Quoted 2 lines
xa_store()may fail so check its return value and if error occurred freenuma_infoand return NULL.
* I find such a change description improvable another bit.
* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16-rc7#n145
Regards,
Markus