From: Minwoo Im Date: Mon, 9 Apr 2018 17:21:27 +0000 (+0900) Subject: nvme-cli: fix seg_fault by cmd options in endurance_log X-Git-Tag: v1.6~56^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c5a8bd22ca81977bfd02f0d6b083260e198399e7;p=users%2Fhch%2Fnvme-cli.git nvme-cli: fix seg_fault by cmd options in endurance_log command_line_options[] might cause a segmentation fault if the last option is not marked. Make it mark NULL to show the end of the list. Signed-off-by: Minwoo Im --- diff --git a/nvme.c b/nvme.c index 97cc20d..0d42863 100644 --- a/nvme.c +++ b/nvme.c @@ -362,6 +362,7 @@ static int get_endurance_log(int argc, char **argv, struct command *cmd, struct const struct argconfig_commandline_options command_line_options[] = { {"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format}, {"group-id", 'g', "NUM", CFG_SHORT, &cfg.group_id, required_argument, group_id}, + {NULL} }; fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));