* [bug report] drm/amd/display: define link res and make it accessible to all link interfaces
@ 2022-01-10 15:30 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-01-10 15:30 UTC (permalink / raw)
To: wenjing.liu; +Cc: amd-gfx
Hello Wenjing Liu,
The patch ef30f441f6ac: "drm/amd/display: define link res and make it
accessible to all link interfaces" from Nov 25, 2021, leads to the
following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:4586 dc_link_set_drive_settings()
warn: address of 'dc->current_state->res_ctx.pipe_ctx[i]' is non-NULL
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:4587 dc_link_set_drive_settings()
error: we previously assumed 'pipe->stream' could be null (see line 4581)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c
4568 void dc_link_set_drive_settings(struct dc *dc,
4569 struct link_training_settings *lt_settings,
4570 const struct dc_link *link)
4571 {
4572
4573 int i;
4574 struct pipe_ctx *pipe = NULL;
4575 const struct link_resource *link_res;
4576
4577 link_res = dc_link_get_cur_link_res(link);
4578
4579 for (i = 0; i < MAX_PIPES; i++) {
4580 pipe = &dc->current_state->res_ctx.pipe_ctx[i];
4581 if (pipe->stream && pipe->stream->link) {
^^^^^^^^^^^^
This checks for "pipe->stream"
4582 if (pipe->stream->link == link)
4583 break;
4584 }
4585 }
4586 if (pipe && link_res)
"pipe" can't possibly be NULL
--> 4587 dc_link_dp_set_drive_settings(pipe->stream->link, link_res, lt_settings);
This dereferences "pipe->stream" without checking
4588 else
4589 ASSERT_CRITICAL(false);
4590 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-10 15:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 15:30 [bug report] drm/amd/display: define link res and make it accessible to all link interfaces Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.