Skip to contentSkip to conversation

ksm: Fix sysfs path concatenation in ksm_test.h

PATCH Applied Wei Gao via ltp 3 participants 6 messages Jun 8 – Jun 9

lore
Share & tools
lore
#0 lore raw

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.

Fixes 40a366b53adc ("lib: Introduce tst_path_defs.h to consolidate system paths")
---
 testcases/kernel/mem/ksm/ksm_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/ksm/ksm_test.h +1 -1
index d04aa8e2b..d3f61edfb 100644
@@ -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
#1 lore raw

Hi Wei,

Quoted 3 lines · Wei Gao

ksm: Fix sysfs path concatenation in ksm_test.h

Fixes 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
Acked-by Andrea Cervesato Reviewed-by
#2 lore raw

Hi!

Quoted 9 lines · Wei Gao
Quoted 3 lines

ksm: Fix sysfs path concatenation in ksm_test.h

Fixes 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
#3 lore raw

Hi Cyril,

Quoted 13 lines

@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.

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.

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
#4 lore raw
In reply to Wei Gao via 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