Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit a742168

Browse files
srishanmgregkh
authored andcommitted
drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor (v2)
[ Upstream commit 0fe2025 ] This commit adds a null check for the 'afb' variable in the amdgpu_dm_update_cursor function. Previously, 'afb' was assumed to be null at line 8388, but was used later in the code without a null check. This could potentially lead to a null pointer dereference. Changes since v1: - Moved the null check for 'afb' to the line where 'afb' is used. (Alex) Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8433 amdgpu_dm_update_cursor() error: we previously assumed 'afb' could be null (see line 8388) Cc: Tom Chung <chiahsuan.chung@amd.com> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Cc: Roman Li <roman.li@amd.com> Cc: Alex Hung <alex.hung@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Co-developed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 27bc3da commit a742168

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8795,7 +8795,8 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane,
87958795
adev->dm.dc->caps.color.dpp.gamma_corr)
87968796
attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA = 1;
87978797

8798-
attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0];
8798+
if (afb)
8799+
attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0];
87998800

88008801
if (crtc_state->stream) {
88018802
if (!dc_stream_set_cursor_attributes(crtc_state->stream,

0 commit comments

Comments
 (0)