Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] ksm: Fix sysfs path concatenation in ksm_test.h
@ 2026-06-08  7:44 Wei Gao via ltp
  2026-06-08  8:59 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wei Gao via ltp @ 2026-06-08  7:44 UTC (permalink / raw)
  To: ltp

The check() function in ksm_test.h was concatenating PATH_MM_KSM and
the relative path (e.g. "run") directly without a directory separator:

    snprintf(fullpath, BUFSIZ, PATH_MM_KSM "%s", path);

This resulted in invalid paths like "/sys/kernel/mm/ksmrun", causing
the tests to fail with TBROK (Failed to open FILE '/sys/kernel/mm/ksmrun').

Fix this by adding the missing slash between PATH_MM_KSM and the subpath.

Fixes: 40a366b53adc ("lib: Introduce tst_path_defs.h to consolidate system paths")
Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/mem/ksm/ksm_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/mem/ksm/ksm_test.h b/testcases/kernel/mem/ksm/ksm_test.h
index d04aa8e2b..d3f61edfb 100644
--- a/testcases/kernel/mem/ksm/ksm_test.h
+++ b/testcases/kernel/mem/ksm/ksm_test.h
@@ -13,7 +13,7 @@ static inline void check(char *path, long int value)
 	char fullpath[BUFSIZ];
 	long actual_val;
 
-	snprintf(fullpath, BUFSIZ, PATH_MM_KSM "%s", path);
+	snprintf(fullpath, BUFSIZ, PATH_MM_KSM "/%s", path);
 	SAFE_FILE_SCANF(fullpath, "%ld", &actual_val);
 
 	if (actual_val != value)
-- 
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-09  8:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  7:44 [LTP] [PATCH v1] ksm: Fix sysfs path concatenation in ksm_test.h Wei Gao via ltp
2026-06-08  8:59 ` [LTP] " linuxtestproject.agent
2026-06-08  9:18   ` Cyril Hrubis
2026-06-08  9:20     ` Andrea Cervesato via ltp
2026-06-08 12:08 ` linuxtestproject.agent
2026-06-09  8:24 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox