[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <536a5850-34af-4a7d-b65d-82147895ef04@infradead.org>
Date: Thu, 21 Dec 2023 21:08:59 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Arnd Bergmann <arnd@...nel.org>, Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>, Rodrigo Siqueira <Rodrigo.Siqueira@....com>
Cc: Arnd Bergmann <arnd@...db.de>, Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Wenjing Liu <wenjing.liu@....com>,
Qingqing Zhuo <qingqing.zhuo@....com>, George Shen <george.shen@....com>,
Jun Lei <Jun.Lei@....com>, Michael Mityushkin <michael.mityushkin@....com>,
Srinivasan Shanmugam <srinivasan.shanmugam@....com>,
Alan Liu <haoping.liu@....com>, Michael Strauss <michael.strauss@....com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amd/display: avoid stringop-overflow warnings for
dp_decide_lane_settings()
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