]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/mm/cow: modify the incorrect checking parameters
authorHao Ge <gehao@kylinos.cn>
Mon, 13 Jan 2025 03:28:58 +0000 (11:28 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 26 Jan 2025 04:22:41 +0000 (20:22 -0800)
In run_with_memfd_hugetlb(), some error handle have passed incorrect
parameters.  It should be "smem", but it was mistakenly written as "mem".

Let's fix it.

[gehao@kylinos.cn: fix other errant sites, per Anshuman]
Link: https://lkml.kernel.org/r/20250113050908.93638-1-hao.ge@linux.dev
Link: https://lkml.kernel.org/r/20250113032858.63670-1-hao.ge@linux.dev
Fixes: f8664f3c4a08 ("selftests/vm: cow: basic COW tests for non-anonymous pages")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Cc: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/cow.c

index 1238e1c5aae150568b64cf5837f86b1499695181..9446673645ebabde40057093c239f69658909dbc 100644 (file)
@@ -1482,7 +1482,7 @@ static void run_with_zeropage(non_anon_test_fn fn, const char *desc)
        }
 
        smem = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0);
-       if (mem == MAP_FAILED) {
+       if (smem == MAP_FAILED) {
                ksft_test_result_fail("mmap() failed\n");
                goto munmap;
        }
@@ -1583,7 +1583,7 @@ static void run_with_memfd(non_anon_test_fn fn, const char *desc)
                goto close;
        }
        smem = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0);
-       if (mem == MAP_FAILED) {
+       if (smem == MAP_FAILED) {
                ksft_test_result_fail("mmap() failed\n");
                goto munmap;
        }
@@ -1634,7 +1634,7 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)
                goto close;
        }
        smem = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0);
-       if (mem == MAP_FAILED) {
+       if (smem == MAP_FAILED) {
                ksft_test_result_fail("mmap() failed\n");
                goto munmap;
        }
@@ -1684,7 +1684,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc,
                goto close;
        }
        smem = mmap(NULL, hugetlbsize, PROT_READ, MAP_SHARED, fd, 0);
-       if (mem == MAP_FAILED) {
+       if (smem == MAP_FAILED) {
                ksft_test_result_fail("mmap() failed\n");
                goto munmap;
        }
@@ -1696,7 +1696,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc,
        fn(mem, smem, hugetlbsize);
 munmap:
        munmap(mem, hugetlbsize);
-       if (mem != MAP_FAILED)
+       if (smem != MAP_FAILED)
                munmap(smem, hugetlbsize);
 close:
        close(fd);