Thread (4 messages) flat view 4 messages, 3 authors, 2021-04-01

Re: [PATCH] ARM: keystone: fix integer overflow warning

From: Santosh Shilimkar <hidden>
Date: 2021-03-23 17:57:43
Also in: lkml

On Mar 23, 2021, at 6:18 AM, Arnd Bergmann [off-list ref] wrote:

From: Arnd Bergmann <arnd@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@arndb.de>
—
Looks fine to me.

Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help