[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_NN+gW5rRezagGr=uno0qSD1rAqMbtLtH-YWV9hGmhfPw@mail.gmail.com>
Date: Wed, 3 Jan 2024 09:49:03 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: Arnd Bergmann <arnd@...nel.org>, Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>, Alan Liu <haoping.liu@....com>,
Srinivasan Shanmugam <srinivasan.shanmugam@....com>, Arnd Bergmann <arnd@...db.de>,
Qingqing Zhuo <qingqing.zhuo@....com>, "Pan, Xinhui" <Xinhui.Pan@....com>,
Wenjing Liu <wenjing.liu@....com>, linux-kernel@...r.kernel.org,
amd-gfx@...ts.freedesktop.org,
Michael Mityushkin <michael.mityushkin@....com>, Michael Strauss <michael.strauss@....com>,
dri-devel@...ts.freedesktop.org, Daniel Vetter <daniel@...ll.ch>,
George Shen <george.shen@....com>, Alex Deucher <alexander.deucher@....com>,
Jun Lei <Jun.Lei@....com>, David Airlie <airlied@...il.com>,
Christian König <christian.koenig@....com>
Subject: Re: [PATCH] drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings()
Applied. Thanks!
On Mon, Dec 25, 2023 at 5:30 AM Randy Dunlap <rdunlap@...radead.org> wrote:
>
>
>
> On 11/22/23 14:13, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > gcc prints a warning about a possible array overflow for a couple of
> > callers of dp_decide_lane_settings() after commit 1b56c90018f0 ("Makefile:
> > Enable -Wstringop-overflow globally"):
> >
> > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c: In function 'dp_perform_fixed_vs_pe_training_sequence_legacy':
> > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c:426:25: error: 'dp_decide_lane_settings' accessing 4 bytes in a region of size 1 [-Werror=stringop-overflow=]
> > 426 | dp_decide_lane_settings(lt_settings, dpcd_lane_adjust,
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 427 | lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings);
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c:426:25: note: referencing argument 4 of type 'union dpcd_training_lane[4]'
> >
> > I'm not entirely sure what caused this, but changing the prototype to expect
> > a pointer instead of an array avoids the warnings.
> >
> > Fixes: 7727e7b60f82 ("drm/amd/display: Improve robustness of FIXED_VS link training at DP1 rates")
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
>
>
> Acked-by: Randy Dunlap <rdunlap@...radead.org>
> Tested-by: Randy Dunlap <rdunlap@...radead.org> # build-tested
>
> Thanks.
>
> > ---
> > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 2 +-
> > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.h | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
> > index 90339c2dfd84..5a0b04518956 100644
> > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
> > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
> > @@ -807,7 +807,7 @@ void dp_decide_lane_settings(
> > const struct link_training_settings *lt_settings,
> > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX],
> > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX],
> > - union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP_MAX])
> > + union dpcd_training_lane *dpcd_lane_settings)
> > {
> > uint32_t lane;
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h
> > index 7d027bac8255..851bd17317a0 100644
> > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h
> > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h
> > @@ -111,7 +111,7 @@ void dp_decide_lane_settings(
> > const struct link_training_settings *lt_settings,
> > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX],
> > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX],
> > - union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP_MAX]);
> > + union dpcd_training_lane *dpcd_lane_settings);
> >
> > enum dc_dp_training_pattern decide_cr_training_pattern(
> > const struct dc_link_settings *link_settings);
>
> --
> #Randy
> https://people.kernel.org/tglx/notes-about-netiquette
> https://subspace.kernel.org/etiquette.html
Powered by blists - more mailing lists