From: Giardi Sylwyn Date: Wed, 19 Mar 2025 10:23:16 +0000 (+0100) Subject: LU-18832 utils: lctl set_param --help segfault X-Git-Tag: 2.16.54~31 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f4a6b56cd2a7ab08f4627b3542151143abacc8a1;p=fs%2Flustre-release.git LU-18832 utils: lctl set_param --help segfault 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 Change-Id: I50cf97cf132e899a4f5c4a8f079638ecfe9ca6a4 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58510 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Oleg Drokin Reviewed-by: Etienne AUJAMES Reviewed-by: Andreas Dilger --- diff --git a/lustre/utils/lustre_param.c b/lustre/utils/lustre_param.c index b253b71..0676990 100644 --- a/lustre/utils/lustre_param.c +++ b/lustre/utils/lustre_param.c @@ -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;