Currently __pagemap_scan_get_categories returns the result from the
ioctl call which should be an int, not uint64_t. The ioctl may
return -1 on error, which will be interpreted as UINT64_MAX. Adjust
the return type to use the correct value.

Fixes: 600bca580579 ("selftests/mm: check that PAGEMAP_SCAN returns correct 
categories")

Signed-off-by: Audra Mitchell <[email protected]>
---
 tools/testing/selftests/mm/vm_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/mm/vm_util.c 
b/tools/testing/selftests/mm/vm_util.c
index 311fc5b4513e..6b65bd0a1e0b 100644
--- a/tools/testing/selftests/mm/vm_util.c
+++ b/tools/testing/selftests/mm/vm_util.c
@@ -31,7 +31,7 @@ uint64_t pagemap_get_entry(int fd, char *start)
        return entry;
 }
 
-static uint64_t __pagemap_scan_get_categories(int fd, char *start, struct 
page_region *r)
+static int __pagemap_scan_get_categories(int fd, char *start, struct 
page_region *r)
 {
        struct pm_scan_arg arg;
 
@@ -55,7 +55,7 @@ static uint64_t __pagemap_scan_get_categories(int fd, char 
*start, struct page_r
 static uint64_t pagemap_scan_get_categories(int fd, char *start)
 {
        struct page_region r;
-       long ret;
+       int ret;
 
        ret = __pagemap_scan_get_categories(fd, start, &r);
        if (ret < 0)
-- 
2.52.0


Reply via email to