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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8c69e939-3019-45cb-9486-510ce7fcb78e@arm.com>
Date: Mon, 2 Sep 2024 10:42:30 +0100
From: Steven Price <steven.price@....com>
To: Jinjie Ruan <ruanjinjie@...wei.com>, boris.brezillon@...labora.com,
 liviu.dudau@....com, maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
 tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch,
 dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] drm/panthor: Use the BITS_PER_LONG macro

On 02/09/2024 10:44, Jinjie Ruan wrote:
> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
> variable, replace it with BITS_PER_LONG macro to make them simpler.
> 
> And fix the warning:
> 	WARNING: Comparisons should place the constant on the right side of the test
> 	#23: FILE: drivers/gpu/drm/panthor/panthor_mmu.c:2696:
> 	+       if (BITS_PER_LONG < va_bits) {
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>

Reviewed-by: Steven Price <steven.price@....com>

Thanks, I'll push to drm-misc-next.

Steve

> ---
> v2:
> - Also fix for below mmu_features.
> - Remoove -next.
> ---
>  drivers/gpu/drm/panthor/panthor_mmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index fa0a002b1016..7b1c345669b7 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -2693,9 +2693,9 @@ int panthor_mmu_init(struct panthor_device *ptdev)
>  	 * which passes iova as an unsigned long. Patch the mmu_features to reflect this
>  	 * limitation.
>  	 */
> -	if (sizeof(unsigned long) * 8 < va_bits) {
> +	if (va_bits > BITS_PER_LONG) {
>  		ptdev->gpu_info.mmu_features &= ~GENMASK(7, 0);
> -		ptdev->gpu_info.mmu_features |= sizeof(unsigned long) * 8;
> +		ptdev->gpu_info.mmu_features |= BITS_PER_LONG;
>  	}
>  
>  	return drmm_add_action_or_reset(&ptdev->base, panthor_mmu_release_wq, mmu->vm.wq);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ