linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm, cma: fix 32-bit warning
@ 2025-02-24 14:07 Arnd Bergmann
  2025-02-24 14:07 ` [PATCH 2/2] mm, cma: use literal printf format string Arnd Bergmann
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-02-24 14:07 UTC (permalink / raw)
  To: Andrew Morton, Nathan Chancellor, Frank van der Linden
  Cc: Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	David Hildenbrand, Zi Yan, linux-mm, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

clang warns about certain always-true conditions, like this one on 32-bit
builds:

mm/cma.c:420:13: error: result of comparison of constant 4294967296 with expression of type 'phys_addr_t' (aka 'unsigned int') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
  420 |                 if (start < SZ_4G)
      |                     ~~~~~ ^ ~~~~~

Replace this one with an equivalent expression that does not cause a warning.

Fixes: 4765deffa0f7 ("mm, cma: support multiple contiguous ranges, if requested")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma.c b/mm/cma.c
index 34a4df29af72..ef0206c0f16d 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -417,7 +417,7 @@ int __init cma_declare_contiguous_multi(phys_addr_t total_size,
 	 * Create a list of ranges above 4G, largest range first.
 	 */
 	for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &start, &end, NULL) {
-		if (start < SZ_4G)
+		if (upper_32_bits(start) == 0)
 			continue;
 
 		start = ALIGN(start, align);
-- 
2.39.5



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

end of thread, other threads:[~2025-02-24 17:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-24 14:07 [PATCH 1/2] mm, cma: fix 32-bit warning Arnd Bergmann
2025-02-24 14:07 ` [PATCH 2/2] mm, cma: use literal printf format string Arnd Bergmann
2025-02-24 14:27   ` Zi Yan
2025-02-24 14:37   ` David Hildenbrand
2025-02-24 17:02   ` Frank van der Linden
2025-02-24 14:26 ` [PATCH 1/2] mm, cma: fix 32-bit warning Zi Yan
2025-02-24 14:36 ` David Hildenbrand
2025-02-24 17:00 ` Frank van der Linden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox