]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
nvme-cli: fix seg_fault by cmd options in endurance_log
authorMinwoo Im <minwoo.im.dev@gmail.com>
Mon, 9 Apr 2018 17:21:27 +0000 (02:21 +0900)
committerMinwoo Im <minwoo.im.dev@gmail.com>
Mon, 9 Apr 2018 17:21:27 +0000 (02:21 +0900)
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 <minwoo.im.dev@gmail.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 97cc20dbb71fe6a948ace6775476ba5de968e4fd..0d42863bdb69a3717a14e2c536989cd5840f6e30 100644 (file)
--- 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));