[LTP] [PATCH] cgroup_xattr: Remove unused variable

Martin Doucha mdoucha@suse.cz
Tue Dec 9 14:54:25 CET 2025


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.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c b/testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c
index 0d016b583..2c080933e 100644
--- a/testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c
+++ b/testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c
@@ -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;
 		}
 
-- 
2.51.0



More information about the ltp mailing list