Re: [PATCH] drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied.  Thanks!

On Mon, Dec 25, 2023 at 5:30 AM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>
>
>
> On 11/22/23 14:13, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@xxxxxxxx>
> >
> > 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@xxxxxxxx>
>
>
> Acked-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> # 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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux