diff mbox series

[v2] selftests/mm/cow: Fix the incorrect error handling

Message ID 20250312043840.71799-1-cyan.yang@sifive.com (mailing list archive)
State New
Headers show
Series [v2] selftests/mm/cow: Fix the incorrect error handling | expand

Commit Message

Cyan Yang March 12, 2025, 4:38 a.m. UTC
There is an error handling did not check the correct return value.
This patch will fix it.

Fixes: f4b5fd6946e244cdedc3bbb9a1f24c8133b2077a ("selftests/vm: anon_cow: THP tests")
Signed-off-by: Cyan Yang <cyan.yang@sifive.com>
---
 tools/testing/selftests/mm/cow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dev Jain March 12, 2025, 4:58 a.m. UTC | #1
On 12/03/25 10:08 am, Cyan Yang wrote:
> There is an error handling did not check the correct return value.
> This patch will fix it.
> 
> Fixes: f4b5fd6946e244cdedc3bbb9a1f24c8133b2077a ("selftests/vm: anon_cow: THP tests")
> Signed-off-by: Cyan Yang <cyan.yang@sifive.com>

Reviewed-by: Dev Jain <dev.jain@arm.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 9446673645eb..f0cb14ea8608 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -876,7 +876,7 @@  static void do_run_with_thp(test_fn fn, enum thp_run thp_run, size_t thpsize)
 		mremap_size = thpsize / 2;
 		mremap_mem = mmap(NULL, mremap_size, PROT_NONE,
 				  MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-		if (mem == MAP_FAILED) {
+		if (mremap_mem == MAP_FAILED) {
 			ksft_test_result_fail("mmap() failed\n");
 			goto munmap;
 		}