Re: [PATCH] drm/amdgpu: : Fix the null pointer dereference for amdgpu_device_switch_gang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 03.07.24 um 11:01 schrieb Bob Zhou:
To avoid null pointer dereference reported by Coverity,
so add null pointer check for the return of amdgpu_device_get_gang().

NAK, that's complete nonsense in the first place.

The pointer is guaranteed to be never NULL or otherwise the logic would have crashed long before.

Regards,
Christian.


Signed-off-by: Bob Zhou <bob.zhou@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bcacf2e35eba..c1d82c346daa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -6569,7 +6569,7 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
  		if (old == gang)
  			break;
- if (!dma_fence_is_signaled(old))
+		if (!old || !dma_fence_is_signaled(old))
  			return old;
} while (cmpxchg((struct dma_fence __force **)&adev->gang_submit,




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux