Skip to contentSkip to conversation

drm/amd/display: Check pipe_ctx before it is used

PATCH Superseded Ma Ke 2 participants 3 messages Jun 24, 2024

Subsystems (3)
lore
Share & tools
lore

Ma Ke

author
#0 lore raw

PATCH 1/1 drm/amd/display: Check pipe_ctx before it is used

resource_get_otg_master_for_stream() could return NULL, we should check the return value of 'otg_master' before it is used in resource_log_pipe_for_stream().

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -0
index 15819416a2f3..597ca9f369c6 100644
@@ -2279,6 +2279,8 @@ void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state)
 					state->stream_status[stream_idx].mall_stream_config.paired_stream);
 			otg_master = resource_get_otg_master_for_stream(
 					&state->res_ctx, state->streams[phantom_stream_idx]);
+			if (!otg_master)
+				continue;
 			resource_log_pipe_for_stream(dc, state, otg_master, stream_idx);
 		}
 	}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 3 lines

resource_get_otg_master_for_stream() could return NULL, we should check the return value of 'otg_master' before it is used in resource_log_pipe_for_stream().

A similar fix was integrated already according to a contribution
by Natanel Roizenman.
From which Linux version did you take source files for your static code analyses?

Please take another look at the corresponding software update.
[PATCH 16/37] drm/amd/display: Add null check in resource_log_pipe_topology_update
https://lore.kernel.org/amd-gfx/[email protected]/

Regards,
Markus

#2 lore raw
Quoted 11 lines
Quoted 3 lines

resource_get_otg_master_for_stream() could return NULL, we should check the return value of 'otg_master' before it is used in resource_log_pipe_for_stream().

A similar fix was integrated already according to a contribution
by Natanel Roizenman.
From which Linux version did you take source files for your static code analyses?

Please take another look at the corresponding software update.
[PATCH 16/37] drm/amd/display: Add null check in resource_log_pipe_topology_update
https://lore.kernel.org/amd-gfx/[email protected]/

How “interesting” is it that a similar source code correction needed to be repeated by Hersen Wu?

drm/amd/display: Add otg_master NULL check within resource_log_pipe_topology_update
https://lore.kernel.org/amd-gfx/[email protected]/

Regards,
Markus