ksm: Fix sysfs path concatenation in ksm_test.h
PATCH 1/1 ksm: Fix sysfs path concatenation in ksm_test.h
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.
--- testcases/kernel/mem/ksm/ksm_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/ksm/ksm_test.h +1 -1
@@ -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)
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wei,
Quoted 3 lines · Wei Gao
ksm: Fix sysfs path concatenation in
ksm_test.hFixes 40a366b53adc ("lib: Introduce tst_path_defs.h to consolidate system paths")
This commit hash does not exist in the LTP repository. Could the reference be verified and corrected?
Verdict: Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 9 lines · Wei Gao
Quoted 3 lines
ksm: Fix sysfs path concatenation in
ksm_test.hFixes 40a366b53adc ("lib: Introduce tst_path_defs.h to consolidate system paths")This commit hash does not exist in the LTP repository. Could the reference be verified and corrected?
Verdict: Needs revision
@Andrea the bot still misses existing patches:
$ git log 40a366b53adc
commit 40a366b53adc477d950cc73f071b0cd4ebe25f85
Author: Li Wang <[email protected]> Date: Thu Jun 4 17:41:59 2026 +0800
lib: Introduce tst_path_defs.h to consolidate system paths
We have a lot of hardcoded strings and duplicated macros for /proc and /sys paths scattered throughout the testcases.
This patch introduces a new common header, tst_path_defs.h, to centralize and standardize these path definitions. By unifying these macros, we reduce code duplication, improve maintainability, and ensure consistent path usage across the entire LTP codebase.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
Quoted 13 lines
@Andrea the bot still misses existing patches:
$ git log 40a366b53adccommit
40a366b53adc477d950cc73f071b0cd4ebe25f85Author: Li Wang <[email protected]> Date: Thu Jun 4 17:41:59 2026 +0800lib: Introduce
tst_path_defs.hto consolidate system pathsWe have a lot of hardcoded strings and duplicated macros for /proc and /sys paths scattered throughout the testcases.
Quoted 8 lines
This patch introduces a new common header,
tst_path_defs.h, to centralize and standardize these path definitions. By unifying these macros, we reduce code duplication, improve maintainability, and ensure consistent path usage across the entire LTP codebase.Signed-off-by Li Wang <[email protected]>Acked-by Andrea Cervesato <[email protected]>Reviewed-by Cyril Hrubis <[email protected]>
Yes I seen, this is really annoying. I will find a way to fix it, but it's supposed to be fixed already.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wei,
Quoted 1 line · Wei Gao
ksm: Fix sysfs path concatenation in
ksm_test.h
Verdict: Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp