tools/testing/selftests/mm/cow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
From: Hao Ge <gehao@kylinos.cn>
In the cow.c,some error handle have passed incorrect
parameters. It should be "smem", but it was mistakenly
written as "mem".
Let's fix it.
Fixes: f8664f3c4a08 ("selftests/vm: cow: basic COW tests for non-anonymous pages")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
v2: Anshuman pointed out that the error is not limited to the run_with_memfd_hugetlb function;
there are other places where it occurs as well.
Therefore, let's fix it all together.
Similarly, Update the Fix tag to be accurate.
---
tools/testing/selftests/mm/cow.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 32c6ccc2a6be..c52c93996ba1 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -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);
--
2.25.1
On 13/01/25 10:39 am, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
>
> In the cow.c,some error handle have passed incorrect
> parameters. It should be "smem", but it was mistakenly
> written as "mem".
>
> Let's fix it.
>
> Fixes: f8664f3c4a08 ("selftests/vm: cow: basic COW tests for non-anonymous pages")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
You should also CC the person whose code you are changing, in this case,
David Hildenbrand.
Reviewed-by: Dev Jain <dev.jain@arm.com>
A small nit.
Please always send a new patch version separately as a new email
thread instead - not part of an ongoing discussion.
On 1/13/25 10:39, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
>
> In the cow.c,some error handle have passed incorrect
> parameters. It should be "smem", but it was mistakenly
> written as "mem".
>
> Let's fix it.
>
> Fixes: f8664f3c4a08 ("selftests/vm: cow: basic COW tests for non-anonymous pages")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
> v2: Anshuman pointed out that the error is not limited to the run_with_memfd_hugetlb function;
> there are other places where it occurs as well.
> Therefore, let's fix it all together.
> Similarly, Update the Fix tag to be accurate.
LGTM
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> tools/testing/selftests/mm/cow.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
> index 32c6ccc2a6be..c52c93996ba1 100644
> --- a/tools/testing/selftests/mm/cow.c
> +++ b/tools/testing/selftests/mm/cow.c
> @@ -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);
© 2016 - 2025 Red Hat, Inc.