mrelease_test doubles the child allocation when process_mrelease()
returns ESRCH.

When size is already MAX_SIZE_MB, the current <= check still allows
another retry, causing the allocation to grow from 1024 MB to 2048 MB.

Use < instead of <= so the largest allocation attempted remains
MAX_SIZE_MB.

LLM used in discovering bug. Changes were made and reviewed manually.

Fixes: 33776141b812 ("selftests: vm: add process_mrelease tests")
Assisted-by: LLM
Signed-off-by: Aveline Noir <[email protected]>
---
 tools/testing/selftests/mm/mrelease_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/mrelease_test.c
b/tools/testing/selftests/mm/mrelease_test.c
index 64e8d00ae944..a5124c9e9f43 100644
--- a/tools/testing/selftests/mm/mrelease_test.c
+++ b/tools/testing/selftests/mm/mrelease_test.c
@@ -157,7 +157,7 @@ int main(void)
                 * Retry until we succeed or reach MAX_SIZE_MB.
                 */
                if (errno == ESRCH) {
-                       retry = (size <= MAX_SIZE_MB);
+                       retry = (size < MAX_SIZE_MB);
                } else {
                        waitpid(pid, NULL, 0);
                        ksft_exit_fail_msg("process_mrelease: %s\n", 
strerror(errno));
-- 
2.55.0

Reply via email to