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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221025082237.GB9520@duo.ucw.cz>
Date:   Tue, 25 Oct 2022 10:22:37 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        David Gow <davidgow@...gle.com>,
        Tales Aparecida <tales.aparecida@...il.com>,
        Alex Deucher <alexander.deucher@....com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 195/229] drm/amd/display: fix overflow on MIN_I64
 definition

Hi!

> From: David Gow <davidgow@...gle.com>
> 
> [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ]
> 
> The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about
> integer overflow, because it is treated as a positive value, which is
> then negated. The temporary positive value is not necessarily
> representable.
> 
> This causes the following warning:
> ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19:
> warning: integer overflow in expression ‘-9223372036854775808’ of type
> ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow]
>   30 |         (int64_t)(-(1LL << 63))
>      |                   ^
> 
> Writing out (-MAX_I64 - 1) works instead.

While this probably fixes the warning, better fix would be to include
limits.h which already has equivalent definitions.

Thanks and best regards,
								Pavel

> -#define MIN_I64 \
> -	(int64_t)(-(1LL << 63))
> -
>  #define MAX_I64 \
>  	(int64_t)((1ULL << 63) - 1)
>  
> +#define MIN_I64 \
> +	(-MAX_I64 - 1)
> +
>  #define FRACTIONAL_PART_MASK \
>  	((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
>  
> -- 
> 2.35.1
> 
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ