]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/amd/display: Add null check for head_pipe in dcn32_acquire_idle_pipe_for_head_pip...
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Sun, 21 Jul 2024 14:00:16 +0000 (19:30 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Jul 2024 21:41:56 +0000 (17:41 -0400)
commitac2140449184a26eac99585b7f69814bd3ba8f2d
treed0018cc8caf3a7b962a06daf96779f1c7d1a6caf
parentf22f4754aaa47d8c59f166ba3042182859e5dff7
drm/amd/display: Add null check for head_pipe in dcn32_acquire_idle_pipe_for_head_pipe_in_layer

This commit addresses a potential null pointer dereference issue in the
`dcn32_acquire_idle_pipe_for_head_pipe_in_layer` function. The issue
could occur when `head_pipe` is null.

The fix adds a check to ensure `head_pipe` is not null before asserting
it. If `head_pipe` is null, the function returns NULL to prevent a
potential null pointer dereference.

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn32/dcn32_resource.c:2690 dcn32_acquire_idle_pipe_for_head_pipe_in_layer() error: we previously assumed 'head_pipe' could be null (see line 2681)

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>
Cc: Hamza Mahfooz <hamza.mahfooz@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>
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c