There is a check just before for-loop that should ensure pipe_ctx is not null: /* Only supports single display */ if (context->stream_count != 1) return false; To remove the subject warning - we can rather add an assert: assert(pipe_ctx); Thanks, Roman -----Original Message----- From: Grodzovsky, Andrey Sent: Monday, March 12, 2018 6:23 PM To: David Binderman <dcb314 at hotmail.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Zhou, David(ChunMing) <David1.Zhou at amd.com>; airlied at linux.ie; amd-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org; linux-kernel at vger.kernel.org; Wentland, Harry <Harry.Wentland at amd.com>; Li, Roman <Roman.Li at amd.com> Subject: Re: linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx On 03/12/2018 06:22 AM, David Binderman wrote: > hello there, > > Source code is > > > Â Â Â for (i = 0; i < dc->res_pool->pipe_count; i++) { > Â Â Â Â Â Â Â if (res_ctx->pipe_ctx[i].stream) { > Â Â Â Â Â Â Â Â Â Â Â pipe_ctx = &res_ctx->pipe_ctx[i]; > Â Â Â Â Â Â Â Â Â Â Â *pipe_idx = i; > Â Â Â Â Â Â Â Â Â Â Â break; > Â Â Â Â Â Â Â } > Â Â Â } Indeed something like if (!pipe_ctx) Â Â Â Â Â Â Â Â Â Â Â Â Â return false; seems the right thing here. Harry, Roman , your opinion ? Andrey > > Â Â Â /* Only supports eDP */ > Â Â Â if (pipe_ctx->stream->sink->link->connector_signal != > SIGNAL_TYPE_EDP) > Â Â Â Â Â Â Â return false; > > Suggest add some code to deal with the case that the for loop doesn't > find what it is looking for and so pipe_ctx is NULL. > > Regards > > David Binderman > > _______________________________________________ > amd-gfx mailing list > amd-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx