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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 17 Jun 2019 14:33:25 +0100
From:   Liviu Dudau <liviu.dudau@....com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     "James (Qian) Wang" <james.qian.wang@....com>,
        Brian Starkey <brian.starkey@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        "Lowry Li (Arm Technology China)" <Lowry.Li@....com>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/komeda: fix 32-bit komeda_crtc_update_clock_ratio

On Mon, Jun 17, 2019 at 02:51:04PM +0200, Arnd Bergmann wrote:
> clang points out a bug in the clock calculation on 32-bit, that leads
> to the clock_ratio always being zero:
> 
> drivers/gpu/drm/arm/display/komeda/komeda_crtc.c:31:36: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
>         aclk = komeda_calc_aclk(kcrtc_st) << 32;
> 
> Move the shift into the division to make it apply on a 64-bit
> variable. Also use the more expensive div64_u64() instead of div_u64()
> to account for pxlclk being a 64-bit integer.
> 
> Fixes: a962091227ed ("drm/komeda: Add engine clock requirement check for the downscaling")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Acked-by: Liviu Dudau <liviu.dudau@....com>

Thanks for the patch, I will pull it into the komeda tree.

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> index cafb4457e187..3f222f464eb2 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> @@ -28,10 +28,9 @@ static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st)
>  	}
>  
>  	pxlclk = kcrtc_st->base.adjusted_mode.clock * 1000;
> -	aclk = komeda_calc_aclk(kcrtc_st) << 32;
> +	aclk = komeda_calc_aclk(kcrtc_st);
>  
> -	do_div(aclk, pxlclk);
> -	kcrtc_st->clock_ratio = aclk;
> +	kcrtc_st->clock_ratio = div64_u64(aclk << 32, pxlclk);
>  }
>  
>  /**
> -- 
> 2.20.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ