mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx
       [not found] <HE1PR0802MB2331D43DAFA4EDDE964F0CC69CD30@HE1PR0802MB2331.eurprd08.prod.outlook.com>
@ 2018-03-12 22:23 ` Andrey Grodzovsky
  2018-03-12 23:06   ` Li, Roman
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Grodzovsky @ 2018-03-12 22:23 UTC (permalink / raw)
  To: David Binderman, alexander.deucher, christian.koenig,
	David1.Zhou, airlied, amd-gfx, dri-devel, linux-kernel,
	Harry Wentland, Li, Roman



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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx
  2018-03-12 22:23 ` linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx Andrey Grodzovsky
@ 2018-03-12 23:06   ` Li, Roman
  2018-03-12 23:10     ` Andrey Grodzovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Li, Roman @ 2018-03-12 23:06 UTC (permalink / raw)
  To: Grodzovsky, Andrey, David Binderman, Deucher, Alexander, Koenig,
	Christian, Zhou, David(ChunMing),
	airlied, amd-gfx, dri-devel, linux-kernel, Wentland, Harry

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@hotmail.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; airlied@linux.ie; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Wentland, Harry <Harry.Wentland@amd.com>; Li, Roman <Roman.Li@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx
  2018-03-12 23:06   ` Li, Roman
@ 2018-03-12 23:10     ` Andrey Grodzovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Grodzovsky @ 2018-03-12 23:10 UTC (permalink / raw)
  To: Li, Roman, David Binderman, Deucher, Alexander, Koenig,
	Christian, Zhou, David(ChunMing),
	airlied, amd-gfx, dri-devel, linux-kernel, Wentland, Harry

The check before alone is not enough for a case where there is another 
bug introduced so that

context->stream_count is not in sync with actual number of streams 
across entire resource_context.

At least assert indeed should be there.

Andrey


On 03/12/2018 07:06 PM, Li, Roman wrote:
> 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@hotmail.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; airlied@linux.ie; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Wentland, Harry <Harry.Wentland@amd.com>; Li, Roman <Roman.Li@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@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-12 23:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <HE1PR0802MB2331D43DAFA4EDDE964F0CC69CD30@HE1PR0802MB2331.eurprd08.prod.outlook.com>
2018-03-12 22:23 ` linux-4.16-rc5/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:1723]: (warning) Possible null pointer dereference: pipe_ctx Andrey Grodzovsky
2018-03-12 23:06   ` Li, Roman
2018-03-12 23:10     ` Andrey Grodzovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®