diff options
author | Muhammad Usama Anjum <[email protected]> | 2024-05-20 11:52:48 -0700 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-07-03 19:29:56 -0700 |
commit | c66b0a052c6448d05289b82d789304f1361e995d (patch) | |
tree | ea1c361c699c22c0b679b328f8c2e4b4e31e27a7 | |
parent | 63818aaf0da8c036d600424ac961620dcdc13ce2 (diff) |
selftests: mm: check return values
Check return value and return error/skip the tests.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests")
Signed-off-by: Muhammad Usama Anjum <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r-- | tools/testing/selftests/mm/pagemap_ioctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 2d785aca72a5..bcc73b4e805c 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -1567,8 +1567,10 @@ int main(int argc, char *argv[]) /* 7. File Hugetlb testing */ mem_size = 2*1024*1024; fd = memfd_create("uffd-test", MFD_HUGETLB | MFD_NOEXEC_SEAL); + if (fd < 0) + ksft_exit_fail_msg("uffd-test creation failed %d %s\n", errno, strerror(errno)); mem = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mem) { + if (mem != MAP_FAILED) { wp_init(mem, mem_size); wp_addr_range(mem, mem_size); |