From: Harry Wentland <harry.wentland@amd.com>
To: "Haowen Bai" <baihaowen@meizu.com>, "Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amd/display: Fix pointer dereferenced before checking
Date: Thu, 7 Apr 2022 10:17:55 -0400 [thread overview]
Message-ID: <533ae31b-1794-f28b-a783-a356e9707ef3@amd.com> (raw)
In-Reply-To: <1649310731-15934-1-git-send-email-baihaowen@meizu.com>
On 2022-04-07 01:52, Haowen Bai wrote:
> The pointer dc is dereferencing pointer plane_state before plane_state
> is being null checked. Fix this by assigning plane_state->ctx->dc to
> dc only if plane_state is not NULL, otherwise just NULL.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
> drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
> index 50820e79d3c4..ee22f4422d26 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
> @@ -3211,7 +3211,7 @@ void dcn10_update_pending_status(struct pipe_ctx *pipe_ctx)
> struct dc_plane_state *plane_state = pipe_ctx->plane_state;
> struct timing_generator *tg = pipe_ctx->stream_res.tg;
> bool flip_pending;
> - struct dc *dc = plane_state->ctx->dc;
This has worked for years now, meaning plane_state is never
NULL here. It might be better to drop the NULL check below.
Harry
> + struct dc *dc = plane_state ? plane_state->ctx->dc : NULL;
>
> if (plane_state == NULL)
> return;
next prev parent reply other threads:[~2022-04-07 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 5:52 [PATCH] drm/amd/display: Fix pointer dereferenced before checking Haowen Bai
2022-04-07 14:17 ` Harry Wentland [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-24 9:46 Haowen Bai
2022-03-25 19:57 ` Alex Deucher
2022-03-24 9:27 Haowen Bai
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=533ae31b-1794-f28b-a783-a356e9707ef3@amd.com \
--to=harry.wentland@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=baihaowen@meizu.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sunpeng.li@amd.com \
/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;
as well as URLs for NNTP newsgroup(s).