[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_NyMsQ_NikyA4r=FULB4MwsjroENZGPgGo-tcAQhhxceQ@mail.gmail.com>
Date: Fri, 25 Mar 2022 15:57:22 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Haowen Bai <baihaowen@...zu.com>
Cc: "Wentland, Harry" <harry.wentland@....com>,
"Leo (Sunpeng) Li" <sunpeng.li@....com>,
"Siqueira, Rodrigo" <Rodrigo.Siqueira@....com>,
"Deucher, Alexander" <alexander.deucher@....com>,
Christian Koenig <christian.koenig@....com>,
xinhui pan <Xinhui.Pan@....com>,
Dave Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Fix pointer dereferenced before checking
Applied both patches. Thanks!
Alex
On Thu, Mar 24, 2022 at 9:46 AM Haowen Bai <baihaowen@...zu.com> wrote:
>
> The value actual_pix_clk_100Hz is dereferencing pointer pix_clk_params
> before pix_clk_params is being null checked. Fix this by assigning
> pix_clk_params->requested_pix_clk_100hz to actual_pix_clk_100Hz only if
> pix_clk_params is not NULL, otherwise just NULL.
>
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index 2c7eb98..4db45bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -1162,7 +1162,7 @@ static uint32_t dcn3_get_pix_clk_dividers(
> struct pixel_clk_params *pix_clk_params,
> struct pll_settings *pll_settings)
> {
> - unsigned long long actual_pix_clk_100Hz = pix_clk_params->requested_pix_clk_100hz;
> + unsigned long long actual_pix_clk_100Hz = pix_clk_params ? pix_clk_params->requested_pix_clk_100hz : 0;
> struct dce110_clk_src *clk_src;
>
> clk_src = TO_DCE110_CLK_SRC(cs);
> --
> 2.7.4
>
Powered by blists - more mailing lists