From: Aurabindo Pillai <aurabindo.pillai@amd.com>
To: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
Harry Wentland <harry.wentland@amd.com>,
Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay()
Date: Mon, 8 Jan 2024 11:28:04 -0500 [thread overview]
Message-ID: <70a1d20c-702e-4c2d-8a66-372f26d85f47@amd.com> (raw)
In-Reply-To: <20240108161920.3973404-1-srinivasan.shanmugam@amd.com>
On 2024-01-08 11:19, Srinivasan Shanmugam wrote:
> In edp_setup_replay(), 'struct dc *dc' & 'struct dmub_replay *replay'
> was dereferenced before the pointer 'link' & 'replay' NULL check.
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:947 edp_setup_replay() warn: variable dereferenced before check 'link' (see line 933)
>
> Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
> .../dc/link/protocols/link_edp_panel_control.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> index 7f1196528218..046d3e205415 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> @@ -930,8 +930,8 @@ bool edp_get_replay_state(const struct dc_link *link, uint64_t *state)
> bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream)
> {
> /* To-do: Setup Replay */
> - struct dc *dc = link->ctx->dc;
> - struct dmub_replay *replay = dc->res_pool->replay;
> + struct dc *dc;
> + struct dmub_replay *replay;
> int i;
> unsigned int panel_inst;
> struct replay_context replay_context = { 0 };
> @@ -947,6 +947,10 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream
> if (!link)
> return false;
>
> + dc = link->ctx->dc;
> +
> + replay = dc->res_pool->replay;
> +
> if (!replay)
> return false;
>
> @@ -975,8 +979,7 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream
>
> replay_context.line_time_in_ns = lineTimeInNs;
>
> - if (replay)
> - link->replay_settings.replay_feature_enabled =
> + link->replay_settings.replay_feature_enabled =
> replay->funcs->replay_copy_settings(replay, link, &replay_context, panel_inst);
> if (link->replay_settings.replay_feature_enabled) {
>
Please add Cc: stable@vger.kernel.org in description.
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
next prev parent reply other threads:[~2024-01-08 16:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 16:19 [PATCH] drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay() Srinivasan Shanmugam
2024-01-08 16:28 ` Aurabindo Pillai [this message]
2024-01-08 16:40 ` SRINIVASAN SHANMUGAM
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=70a1d20c-702e-4c2d-8a66-372f26d85f47@amd.com \
--to=aurabindo.pillai@amd.com \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=srinivasan.shanmugam@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