All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/memblock: cast constant ULLONG_MAX to phys_addr_t
@ 2018-03-19  0:56 Stefan Agner
  0 siblings, 0 replies; only message in thread
From: Stefan Agner @ 2018-03-19  0:56 UTC (permalink / raw)
  To: akpm, mhocko, catalin.marinas
  Cc: pasha.tatashin, ard.biesheuvel, linux-mm, linux-kernel, Stefan Agner

This fixes a warning shown when phys_addr_t is 32-bit int
when compiling with clang:
  mm/memblock.c:927:15: warning: implicit conversion from 'unsigned long long'
        to 'phys_addr_t' (aka 'unsigned int') changes value from
        18446744073709551615 to 4294967295 [-Wconstant-conversion]
                                  r->base : ULLONG_MAX;
                                            ^~~~~~~~~~
  ./include/linux/kernel.h:30:21: note: expanded from macro 'ULLONG_MAX'
  #define ULLONG_MAX      (~0ULL)
                           ^~~~~

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 mm/memblock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index b6ba6b7adadc..696829a198ba 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -924,7 +924,7 @@ void __init_memblock __next_mem_range(u64 *idx, int nid, ulong flags,
 			r = &type_b->regions[idx_b];
 			r_start = idx_b ? r[-1].base + r[-1].size : 0;
 			r_end = idx_b < type_b->cnt ?
-				r->base : ULLONG_MAX;
+				r->base : (phys_addr_t)ULLONG_MAX;
 
 			/*
 			 * if idx_b advanced past idx_a,
@@ -1040,7 +1040,7 @@ void __init_memblock __next_mem_range_rev(u64 *idx, int nid, ulong flags,
 			r = &type_b->regions[idx_b];
 			r_start = idx_b ? r[-1].base + r[-1].size : 0;
 			r_end = idx_b < type_b->cnt ?
-				r->base : ULLONG_MAX;
+				r->base : (phys_addr_t)ULLONG_MAX;
 			/*
 			 * if idx_b advanced past idx_a,
 			 * break out to advance idx_a
-- 
2.16.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-19  0:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19  0:56 [PATCH] mm/memblock: cast constant ULLONG_MAX to phys_addr_t Stefan Agner

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.