[PATCH 09/16] selftests/mm: hugetlb-madvise: fix type mismatch issues

Muhammad Usama Anjum
2025-01-09T17:39:51Z

Fix type mismatch warnings:
hugetlb-madvise.c:30:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
30 | if (fhp != (exp_free)) { \
| ^~
hugetlb-madvise.c:114:9: note: in expansion of macro ‘validate_free_pages’
114 | validate_free_pages(free_hugepages - NR_HUGE_PAGES);
| ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/mm/hugetlb-madvise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c
index 43f16c12c8e9a..8f527084858d0 100644
--- a/tools/testing/selftests/mm/hugetlb-madvise.c
+++ b/tools/testing/selftests/mm/hugetlb-madvise.c
@@ -26,7 +26,7 @@

#define validate_free_pages(exp_free) \
do { \
- int fhp = get_free_hugepages(); \
+ unsigned int fhp = get_free_hugepages(); \
if (fhp != (exp_free)) { \
printf("Unexpected number of free huge " \
"pages line %d\n", __LINE__); \
--
2.39.5