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]
Date:   Mon, 27 Sep 2021 14:26:13 +0200
From:   Christian König <christian.koenig@....com>
To:     Arnd Bergmann <arnd@...nel.org>,
        Alex Deucher <alexander.deucher@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Evan Quan <evan.quan@....com>,
        Hawking Zhang <Hawking.Zhang@....com>,
        Huang Rui <ray.huang@....com>, shaoyunl <shaoyun.liu@....com>,
        Andrey Grodzovsky <andrey.grodzovsky@....com>,
        Jack Zhang <Jack.Zhang1@....com>,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] drm/amdgpu: fix clang out-of-range warning

In general that change looks good. But what configuration is that?

Background is that it doesn't make much sense to compile the amdgpu 
driver on systems where resource_size_t is only 32bit.

Christian.

Am 27.09.21 um 14:19 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@...db.de>
>
> clang-14 points out that comparing an 'unsigned int' against a large
> 64-bit constantn is pointless:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1206:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>                      res->start > 0x100000000ull)
>
> Rephrase the comparison using the upper_32_bits() macro, which should
> keep it legible while avoiding the warning.
>
> Fixes: 31b8adab3247 ("drm/amdgpu: require a root bus window above 4GB for BAR resize")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index ab3794c42d36..741a55031ca1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1203,7 +1203,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
>   
>   	pci_bus_for_each_resource(root, res, i) {
>   		if (res && res->flags & (IORESOURCE_MEM | IORESOURCE_MEM_64) &&
> -		    res->start > 0x100000000ull)
> +		    upper_32_bits(res->start) != 0)
>   			break;
>   	}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ