[PATCH 14/16] selftests/mm: thuge-gen: Fix type mismatch warnings

Muhammad Usama Anjum
2025-01-09T17:40:16Z

Fix all the found type mismatch warnings.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/mm/thuge-gen.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c
index e4370b79b62ff..515b89ac4eb59 100644
--- a/tools/testing/selftests/mm/thuge-gen.c
+++ b/tools/testing/selftests/mm/thuge-gen.c
@@ -65,7 +65,7 @@ void show(unsigned long ps)
{
char buf[100];

- if (ps == getpagesize())
+ if ((signed long)ps == getpagesize())
return;

ksft_print_msg("%luMB: ", ps >> 20);
@@ -106,7 +106,7 @@ unsigned long read_sysfs(int warn, char *fmt, ...)

unsigned long read_free(unsigned long ps)
{
- return read_sysfs(ps != getpagesize(),
+ return read_sysfs((signed long)ps != getpagesize(),
"/sys/kernel/mm/hugepages/hugepages-%lukB/free_hugepages",
ps >> 10);
}
@@ -126,7 +126,7 @@ void test_mmap(unsigned long size, unsigned flags)
after = read_free(size);

show(size);
- ksft_test_result(size == getpagesize() || (before - after) == NUM_PAGES,
+ ksft_test_result((signed long)size == getpagesize() || (before - after) == NUM_PAGES,
"%s mmap\n", __func__);

if (munmap(map, size * NUM_PAGES))
@@ -164,7 +164,7 @@ void test_shmget(unsigned long size, unsigned flags)
after = read_free(size);

show(size);
- ksft_test_result(size == getpagesize() || (before - after) == NUM_PAGES,
+ ksft_test_result((signed long)size == getpagesize() || (before - after) == NUM_PAGES,
"%s: mmap\n", __func__);
if (shmdt(map))
ksft_exit_fail_msg("%s: shmdt: %s\n", __func__, strerror(errno));
@@ -173,7 +173,7 @@ void test_shmget(unsigned long size, unsigned flags)
void find_pagesizes(void)
{
unsigned long largest = getpagesize();
- int i;
+ unsigned int i;
glob_t g;

glob("/sys/kernel/mm/hugepages/hugepages-*kB", 0, NULL, &g);
--
2.39.5