[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251106104917.39890-1-ankitkhushwaha.linux@gmail.com>
Date: Thu, 6 Nov 2025 16:19:17 +0530
From: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
Shuah Khan <shuah@...nel.org>,
linux-mm@...ck.org,
linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Subject: [PATCH] selftest/mm: fix pointer comparison in mremap_test
Pointer arthemitic with 'void * addr' and 'unsigned long long dest_alignment'
triggers following warning:
mremap_test.c:1035:31: warning: pointer comparison always evaluates to
false [-Wtautological-compare]
1035 | if (addr + c.dest_alignment < addr) {
| ^
typecasting 'addr' to 'unsigned long long' to fix pointer comparison.
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
---
tools/testing/selftests/mm/mremap_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c
index a95c0663a011..5ae0400176af 100644
--- a/tools/testing/selftests/mm/mremap_test.c
+++ b/tools/testing/selftests/mm/mremap_test.c
@@ -1032,7 +1032,7 @@ static long long remap_region(struct config c, unsigned int threshold_mb,
/* Don't destroy existing mappings unless expected to overlap */
while (!is_remap_region_valid(addr, c.region_size) && !c.overlapping) {
/* Check for unsigned overflow */
- if (addr + c.dest_alignment < addr) {
+ if ((unsigned long long) addr + c.dest_alignment < (unsigned long long) addr) {
ksft_print_msg("Couldn't find a valid region to remap to\n");
ret = -1;
goto clean_up_src;
--
2.51.0
Powered by blists - more mailing lists