Thread (19 messages) 19 messages, 2 authors, 2025-01-07
STALE546d

[PATCH 01/14] selftests/mm: Fix condition in uffd_move_test_common()

From: Kevin Brodsky <hidden>
Date: 2024-12-09 09:50:42
Also in: linux-kselftest, linux-mm, lkml
Subsystem: kernel selftest framework, memory management - misc, memory management - userfaultfd, the rest · Maintainers: Shuah Khan, Andrew Morton, David Hildenbrand, Mike Rapoport, Linus Torvalds

area_src and area_dst are saved at the beginning of the function if
chunk_size > page_size. The intention is quite clearly to restore
them at the end based on the same condition, but step_size is
considered instead of chunk_size. Considering that step_size is a
number of pages, the condition is likely to be false.

Use the same condition as when saving so that the globals are
restored as intended.

Fixes: a2bf6a9ca805 ("selftests/mm: add UFFDIO_MOVE ioctl test")
Signed-off-by: Kevin Brodsky <redacted>
---
 tools/testing/selftests/mm/uffd-unit-tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index a2e71b1636e7..74c884713bf7 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -1190,7 +1190,7 @@ uffd_move_test_common(uffd_test_args_t *targs, unsigned long chunk_size,
 				    nr, count, count_verify[src_offs + nr + i]);
 		}
 	}
-	if (step_size > page_size) {
+	if (chunk_size > page_size) {
 		area_src = orig_area_src;
 		area_dst = orig_area_dst;
 	}
-- 
2.47.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help