All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 13:18 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2021-03-23 13:18 UTC (permalink / raw)
  To: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers
  Cc: soc, Arnd Bergmann, Russell King, Robin Murphy, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, linux-arm-kernel, linux-kernel,
	clang-built-linux

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>
---
 arch/arm/mach-keystone/keystone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index cd711bfc591f..2c647bdf8d25 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -65,7 +65,7 @@ static void __init keystone_init(void)
 static long long __init keystone_pv_fixup(void)
 {
 	long long offset;
-	phys_addr_t mem_start, mem_end;
+	u64 mem_start, mem_end;
 
 	mem_start = memblock_start_of_DRAM();
 	mem_end = memblock_end_of_DRAM();
@@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)
 	if (mem_start < KEYSTONE_HIGH_PHYS_START ||
 	    mem_end   > KEYSTONE_HIGH_PHYS_END) {
 		pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
-		        (u64)mem_start, (u64)mem_end);
+		        mem_start, mem_end);
 		return 0;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 13:18 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2021-03-23 13:18 UTC (permalink / raw)
  To: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers
  Cc: soc, Arnd Bergmann, Russell King, Robin Murphy, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, linux-arm-kernel, linux-kernel,
	clang-built-linux

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>
---
 arch/arm/mach-keystone/keystone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index cd711bfc591f..2c647bdf8d25 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -65,7 +65,7 @@ static void __init keystone_init(void)
 static long long __init keystone_pv_fixup(void)
 {
 	long long offset;
-	phys_addr_t mem_start, mem_end;
+	u64 mem_start, mem_end;
 
 	mem_start = memblock_start_of_DRAM();
 	mem_end = memblock_end_of_DRAM();
@@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)
 	if (mem_start < KEYSTONE_HIGH_PHYS_START ||
 	    mem_end   > KEYSTONE_HIGH_PHYS_END) {
 		pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
-		        (u64)mem_start, (u64)mem_end);
+		        mem_start, mem_end);
 		return 0;
 	}
 
-- 
2.29.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
  2021-03-23 13:18 ` Arnd Bergmann
  (?)
@ 2021-03-23 17:56   ` Santosh Shilimkar
  -1 siblings, 0 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2021-03-23 17:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers, soc,
	Arnd Bergmann, Russell King, Robin Murphy, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, linux-arm-kernel, linux-kernel,
	clang-built-linux



> On Mar 23, 2021, at 6:18 AM, Arnd Bergmann <arnd@kernel.org> 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>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 17:56   ` Santosh Shilimkar
  0 siblings, 0 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2021-03-23 17:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers, soc,
	Arnd Bergmann, Russell King, Robin Murphy, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, linux-arm-kernel, linux-kernel,
	clang-built-linux



> On Mar 23, 2021, at 6:18 AM, Arnd Bergmann <arnd@kernel.org> 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>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 17:56   ` Santosh Shilimkar
  0 siblings, 0 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2021-03-23 17:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers, soc,
	Arnd Bergmann, Russell King, Robin Murphy, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, linux-arm-kernel, linux-kernel,
	clang-built-linux



> On Mar 23, 2021, at 6:18 AM, Arnd Bergmann <arnd@kernel.org> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 18:24   ` Nathan Chancellor
  0 siblings, 0 replies; 9+ messages in thread
From: Nathan Chancellor @ 2021-03-23 18:24 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Santosh Shilimkar, Nick Desaulniers, soc, Arnd Bergmann,
	Russell King, Robin Murphy, Mathieu Poirier, Jim Quinlan,
	Maxime Ripard, linux-arm-kernel, linux-kernel, clang-built-linux

On Tue, Mar 23, 2021 at 02:18:05PM +0100, Arnd Bergmann 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>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  arch/arm/mach-keystone/keystone.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
> index cd711bfc591f..2c647bdf8d25 100644
> --- a/arch/arm/mach-keystone/keystone.c
> +++ b/arch/arm/mach-keystone/keystone.c
> @@ -65,7 +65,7 @@ static void __init keystone_init(void)
>  static long long __init keystone_pv_fixup(void)
>  {
>  	long long offset;
> -	phys_addr_t mem_start, mem_end;
> +	u64 mem_start, mem_end;
>  
>  	mem_start = memblock_start_of_DRAM();
>  	mem_end = memblock_end_of_DRAM();
> @@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)
>  	if (mem_start < KEYSTONE_HIGH_PHYS_START ||
>  	    mem_end   > KEYSTONE_HIGH_PHYS_END) {
>  		pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
> -		        (u64)mem_start, (u64)mem_end);
> +		        mem_start, mem_end);
>  		return 0;
>  	}
>  
> -- 
> 2.29.2
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-03-23 18:24   ` Nathan Chancellor
  0 siblings, 0 replies; 9+ messages in thread
From: Nathan Chancellor @ 2021-03-23 18:24 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Santosh Shilimkar, Nick Desaulniers, soc, Arnd Bergmann,
	Russell King, Robin Murphy, Mathieu Poirier, Jim Quinlan,
	Maxime Ripard, linux-arm-kernel, linux-kernel, clang-built-linux

On Tue, Mar 23, 2021 at 02:18:05PM +0100, Arnd Bergmann 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>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  arch/arm/mach-keystone/keystone.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
> index cd711bfc591f..2c647bdf8d25 100644
> --- a/arch/arm/mach-keystone/keystone.c
> +++ b/arch/arm/mach-keystone/keystone.c
> @@ -65,7 +65,7 @@ static void __init keystone_init(void)
>  static long long __init keystone_pv_fixup(void)
>  {
>  	long long offset;
> -	phys_addr_t mem_start, mem_end;
> +	u64 mem_start, mem_end;
>  
>  	mem_start = memblock_start_of_DRAM();
>  	mem_end = memblock_end_of_DRAM();
> @@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)
>  	if (mem_start < KEYSTONE_HIGH_PHYS_START ||
>  	    mem_end   > KEYSTONE_HIGH_PHYS_END) {
>  		pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
> -		        (u64)mem_start, (u64)mem_end);
> +		        mem_start, mem_end);
>  		return 0;
>  	}
>  
> -- 
> 2.29.2
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-04-01 10:23   ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2021-04-01 10:23 UTC (permalink / raw)
  To: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers, Arnd Bergmann
  Cc: Arnd Bergmann, linux-kernel, linux-arm-kernel, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, soc, Robin Murphy, clang-built-linux,
	Russell King

From: Arnd Bergmann <arnd@arndb.de>

On Tue, 23 Mar 2021 14:18:05 +0100, Arnd Bergmann wrote:
> 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 ||
>             ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Applied to arm/fixes

[1/1] ARM: keystone: fix integer overflow warning
      commit: 04e18e1cc319f453a6d752d4553bb3f29fde5f76

       Arnd

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ARM: keystone: fix integer overflow warning
@ 2021-04-01 10:23   ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2021-04-01 10:23 UTC (permalink / raw)
  To: Santosh Shilimkar, Nathan Chancellor, Nick Desaulniers, Arnd Bergmann
  Cc: Arnd Bergmann, linux-kernel, linux-arm-kernel, Mathieu Poirier,
	Jim Quinlan, Maxime Ripard, soc, Robin Murphy, clang-built-linux,
	Russell King

From: Arnd Bergmann <arnd@arndb.de>

On Tue, 23 Mar 2021 14:18:05 +0100, Arnd Bergmann wrote:
> 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 ||
>             ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Applied to arm/fixes

[1/1] ARM: keystone: fix integer overflow warning
      commit: 04e18e1cc319f453a6d752d4553bb3f29fde5f76

       Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-01 10:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 13:18 [PATCH] ARM: keystone: fix integer overflow warning Arnd Bergmann
2021-03-23 13:18 ` Arnd Bergmann
2021-03-23 17:56 ` Santosh Shilimkar
2021-03-23 17:56   ` Santosh Shilimkar
2021-03-23 17:56   ` Santosh Shilimkar
2021-03-23 18:24 ` Nathan Chancellor
2021-03-23 18:24   ` Nathan Chancellor
2021-04-01 10:23 ` Arnd Bergmann
2021-04-01 10:23   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.