Whamcloud - gitweb
LU-18832 utils: lctl set_param --help segfault 10/58510/4
authorGiardi Sylwyn <sylwyn.giardi@cea.fr>
Wed, 19 Mar 2025 10:23:16 +0000 (11:23 +0100)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Mar 2025 05:58:15 +0000 (05:58 +0000)
Correct a bug when calling lctl. In some cases, using unkown option
made lctl to segfault. Corrected by adding NULL element at the end
of the longpost list to help parsing.

Test-Parameters: trivial
Fixes: e7b8986619 ("LU-17416 utils: option for lctl get_param to skip links")
Signed-off-by: Giardi Sylwyn <sylwyn.giardi@cea.fr>
Change-Id: I50cf97cf132e899a4f5c4a8f079638ecfe9ca6a4
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58510
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/utils/lustre_param.c

index b253b71..0676990 100644 (file)
@@ -652,6 +652,7 @@ static int listparam_cmdline(int argc, char **argv, struct param_opts *popt)
        { .val = 'R',   .name = "recursive",    .has_arg = no_argument},
        { .val = 't',   .name = "tunable",      .has_arg = no_argument},
        { .val = 'w',   .name = "writable",     .has_arg = no_argument},
+       { .name = NULL },
        };
 
        int ch;
@@ -761,6 +762,7 @@ static int getparam_cmdline(int argc, char **argv, struct param_opts *popt)
        { .val = 't',   .name = "tunable",      .has_arg = no_argument},
        { .val = 'w',   .name = "writable",     .has_arg = no_argument},
        { .val = 'y',   .name = "yaml",         .has_arg = no_argument},
+       { .name = NULL },
        };
 
        int ch;
@@ -927,6 +929,7 @@ static int setparam_cmdline(int argc, char **argv, struct param_opts *popt)
        { .val = 'P',   .name = "perm",         .has_arg = no_argument},
        { .val = 'P',   .name = "permanent",    .has_arg = no_argument},
        { .val = 't',   .name = "thread",       .has_arg = optional_argument},
+       { .name = NULL },
        };
 
        int ch;