[PATCH] ARM: keystone: fix integer overflow warning
Santosh Shilimkar
santosh.shilimkar at oracle.com
Tue Mar 23 17:56:13 GMT 2021
> On Mar 23, 2021, at 6:18 AM, Arnd Bergmann <arnd at kernel.org> wrote:
>
> From: Arnd Bergmann <arnd at arndb.de>
>
> clang warns about an impossible condition when building with 32-bit
> phys_addr_t:
>
> arch/arm/mach-keystone/keystone.c:79:16: error: result of comparison of constant 51539607551 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
> mem_end > KEYSTONE_HIGH_PHYS_END) {
> ~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
> arch/arm/mach-keystone/keystone.c:78:16: error: result of comparison of constant 34359738368 with expression of type 'phys_addr_t' (aka 'unsigned int') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
> if (mem_start < KEYSTONE_HIGH_PHYS_START ||
> ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
>
> Change the temporary variable to a fixed-size u64 to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> —
Looks fine to me.
Acked-by: Santosh Shilimkar <ssantosh at kernel.org>
More information about the linux-arm-kernel
mailing list