[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240920090959.30755-1-kdipendra88@gmail.com>
Date: Fri, 20 Sep 2024 09:09:57 +0000
From: Dipendra Khadka <kdipendra88@...il.com>
To: Felix.Kuehling@....com,
alexander.deucher@....com,
christian.koenig@....com,
Xinhui.Pan@....com,
airlied@...il.com,
daniel@...ll.ch
Cc: Dipendra Khadka <kdipendra88@...il.com>,
amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] Staging: drivers/gpu/drm/amd/amdgpu: Fix null pointer deference in amdkfd_fence_get_timeline_name
'''
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:108:9: error: Null pointer dereference: fence [nullPointer]
return fence->timeline_name;
^
'''
The method to_amdgpu_amdkfd_fence can return NULL incase of empty f
or f->ops != &amdkfd_fence_ops.Hence, check has been added .
If fence is null , then null is returned.
Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
index 1ef758ac5076..2313babcc944 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
@@ -105,6 +105,9 @@ static const char *amdkfd_fence_get_timeline_name(struct dma_fence *f)
{
struct amdgpu_amdkfd_fence *fence = to_amdgpu_amdkfd_fence(f);
+ if (!fence)
+ return NULL;
+
return fence->timeline_name;
}
--
2.43.0
Powered by blists - more mailing lists