Skip to contentSkip to conversation

cgroup_xattr: Remove unused variable

PATCH In review Martin Doucha 3 participants 3 messages Dec 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup_xattr: Remove unused variable

The dir variable in mount_cgroup() is uninitialized but it gets printed into error messages instead of the correct opt->dir. Remove the variable and fix the error message.

---
 testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c +1 -2
index 0d016b583..2c080933e 100644
@@ -289,7 +289,6 @@ int mount_cgroup(void)
 
 	int i, any_mounted = 0;
 	for (i = 0; i < cgrp_opt_num; ++i) {
-		char dir[MAX_DIR_NAME];
 		struct cgrp_option *opt = &cgrp_opt[i];
 		tst_resm(TINFO, "mount options %d: %s (hier = %d)",
 			i, opt->str, opt->hier);
@@ -297,7 +296,7 @@ int mount_cgroup(void)
 		SAFE_MKDIR(cleanup, opt->dir, 0755);
 
 		if (mount(opt->dir, opt->dir, "cgroup", 0, opt->str) == -1) {
-			tst_resm(TINFO, "Can't mount: %s", dir);
+			tst_resm(TINFO, "Can't mount: %s", opt->dir);
 			continue;
 		}
 
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Martin, Andrea,

good catch, merged. Thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp