[PATCH] drm/amdgpu: Fix NULL pointer dereference

Grigory Vasilyev h0tc0d3 at gmail.com
Fri Apr 8 09:28:02 UTC 2022


The code below check for NULL, but is no check at this place, which is
potentially dangerous.

Signed-off-by: Grigory Vasilyev <h0tc0d3 at gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index d26810e7311d..c773a92dd4e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1017,8 +1017,10 @@ static int amdgpu_display_get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb
 	int r;
 
 	if (!amdgpu_fb) {
-		*tiling_flags = 0;
-		*tmz_surface = false;
+		if (tiling_flags)
+			*tiling_flags = 0;
+		if (tmz_surface)
+			*tmz_surface = false;
 		return 0;
 	}
 
-- 
2.35.1



More information about the amd-gfx mailing list