mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li, Roman" <Roman.Li@amd.com>
To: "Grodzovsky, Andrey" <Andrey.Grodzovsky@amd.com>,
	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" <airlied@linux.ie>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Wentland, Harry" <Harry.Wentland@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
Date: Mon, 12 Mar 2018 23:06:23 +0000	[thread overview]
Message-ID: <DM5PR12MB1211B9CFBCC532003F5FEDAA89D30@DM5PR12MB1211.namprd12.prod.outlook.com> (raw)
In-Reply-To: <8b55ac58-ae20-7662-10bb-c446701cd67e@amd.com>

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

  reply	other threads:[~2018-03-12 23:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <HE1PR0802MB2331D43DAFA4EDDE964F0CC69CD30@HE1PR0802MB2331.eurprd08.prod.outlook.com>
2018-03-12 22:23 ` Andrey Grodzovsky
2018-03-12 23:06   ` Li, Roman [this message]
2018-03-12 23:10     ` Andrey Grodzovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR12MB1211B9CFBCC532003F5FEDAA89D30@DM5PR12MB1211.namprd12.prod.outlook.com \
    --to=roman.li@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Andrey.Grodzovsky@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=David1.Zhou@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dcb314@hotmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®