Skip to content

Commit c8f3d18

Browse files
mdouchapevik
authored andcommitted
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. Link: https://lore.kernel.org/ltp/[email protected]/ Fixes: 0e335db ("New core test of cgroups and extended attributes") Reviewed-by: Andrea Cervesato <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Signed-off-by: Martin Doucha <[email protected]>
1 parent 36c5164 commit c8f3d18

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

testcases/kernel/controllers/cgroup_xattr/cgroup_xattr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,14 @@ int mount_cgroup(void)
289289

290290
int i, any_mounted = 0;
291291
for (i = 0; i < cgrp_opt_num; ++i) {
292-
char dir[MAX_DIR_NAME];
293292
struct cgrp_option *opt = &cgrp_opt[i];
294293
tst_resm(TINFO, "mount options %d: %s (hier = %d)",
295294
i, opt->str, opt->hier);
296295
snprintf(opt->dir, MAX_DIR_NAME, "cgx_%d", opt->hier);
297296
SAFE_MKDIR(cleanup, opt->dir, 0755);
298297

299298
if (mount(opt->dir, opt->dir, "cgroup", 0, opt->str) == -1) {
300-
tst_resm(TINFO, "Can't mount: %s", dir);
299+
tst_resm(TINFO, "Can't mount: %s", opt->dir);
301300
continue;
302301
}
303302

0 commit comments

Comments
 (0)