lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Jan 2021 13:44:30 +0000
From:   Lee Jones <lee.jones@...aro.org>
To:     linux-kernel@...r.kernel.org,
        Harry Wentland <harry.wentland@....com>,
        Leo Li <sunpeng.li@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Christian König <christian.koenig@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Colin Ian King <colin.king@...onical.com>,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 13/40] drm/amd/display/dc/calcs/dce_calcs: Move some
 large variables from the stack to the heap

On Mon, 11 Jan 2021, Lee Jones wrote:

> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function ‘calculate_bandwidth’:
>  drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2016:1: warning: the frame size of 1216 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> 
> Cc: Harry Wentland <harry.wentland@....com>
> Cc: Leo Li <sunpeng.li@....com>
> Cc: Alex Deucher <alexander.deucher@....com>
> Cc: "Christian König" <christian.koenig@....com>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: Colin Ian King <colin.king@...onical.com>
> Cc: amd-gfx@...ts.freedesktop.org
> Cc: dri-devel@...ts.freedesktop.org
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
> ---
>  .../gpu/drm/amd/display/dc/calcs/dce_calcs.c  | 21 +++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> index 158d927c03e55..a0c69fae40ced 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> @@ -98,16 +98,16 @@ static void calculate_bandwidth(
>  	int32_t num_cursor_lines;
>  
>  	int32_t i, j, k;
> -	struct bw_fixed yclk[3];
> -	struct bw_fixed sclk[8];
> +	struct bw_fixed *yclk;
> +	struct bw_fixed *sclk;
>  	bool d0_underlay_enable;
>  	bool d1_underlay_enable;
>  	bool fbc_enabled;
>  	bool lpt_enabled;
>  	enum bw_defines sclk_message;
>  	enum bw_defines yclk_message;
> -	enum bw_defines tiling_mode[maximum_number_of_surfaces];
> -	enum bw_defines surface_type[maximum_number_of_surfaces];
> +	enum bw_defines *tiling_mode;
> +	enum bw_defines *surface_type;
>  	enum bw_defines voltage;
>  	enum bw_defines pipe_check;
>  	enum bw_defines hsr_check;
> @@ -122,6 +122,14 @@ static void calculate_bandwidth(
>  	int32_t number_of_displays_enabled_with_margin = 0;
>  	int32_t number_of_aligned_displays_with_no_margin = 0;
>  
> +	yclk = kzalloc(sizeof(*yclk) * 3, GFP_KERNEL);
> +	sclk = kzalloc(sizeof(*sclk) * 8, GFP_KERNEL);
> +
> +	tiling_mode = kzalloc(sizeof(*tiling_mode) *
> +			      maximum_number_of_surfaces, GFP_KERNEL);
> +	surface_type = kzalloc(sizeof(*surface_type) *
> +			       maximum_number_of_surfaces, GFP_KERNEL);

Please refrain from merging this yet.  I missed some error checking.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists