Message ID | 20240429194021.5523-1-akumar@suse.de |
---|---|
State | Changes Requested |
Headers | show |
Series | syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID() | expand |
Hi Avinesh, ... > - TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0)); > - > - if (TST_RET_PTR != MAP_FAILED) { > - tst_res(TFAIL, "mmap() was successful unexpectedly"); > - SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE); > - } else if (TST_ERR == tc->exp_errno) { > - tst_res(TPASS | TERRNO, "mmap() failed with"); > - } else { > - tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly"); > - } > + TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno); Also here should IMHO be: if (TST_RET_PTR != MAP_FAILED) { SAFE_MUNMAP(TST_RET_PTR, page_sz); Kind regards, Petr > } > static void cleanup(void)
diff --git a/testcases/kernel/syscalls/mmap/mmap06.c b/testcases/kernel/syscalls/mmap/mmap06.c index 615743fa7..02c186a3a 100644 --- a/testcases/kernel/syscalls/mmap/mmap06.c +++ b/testcases/kernel/syscalls/mmap/mmap06.c @@ -56,16 +56,7 @@ static void run(unsigned int i) { struct tcase *tc = &tcases[i]; - TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0)); - - if (TST_RET_PTR != MAP_FAILED) { - tst_res(TFAIL, "mmap() was successful unexpectedly"); - SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE); - } else if (TST_ERR == tc->exp_errno) { - tst_res(TPASS | TERRNO, "mmap() failed with"); - } else { - tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly"); - } + TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno); } static void cleanup(void)
Signed-off-by: Avinesh Kumar <akumar@suse.de> --- testcases/kernel/syscalls/mmap/mmap06.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)