]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Allow only one option value at a time
authorRandy <rbates@web-site.com>
Wed, 18 Mar 2020 18:44:59 +0000 (13:44 -0500)
committerKeith Busch <kbusch@kernel.org>
Thu, 23 Apr 2020 20:12:38 +0000 (14:12 -0600)
plugins/wdc/wdc-nvme.c

index 2735214f1d285bc3b5f30ed927080c16624475c5..ad86fdeea03b8460f58f0426debe460c99e6dc4a 100644 (file)
@@ -3783,6 +3783,14 @@ static int wdc_vs_telemetry_controller_option(int argc, char **argv, struct comm
                goto out;
        }
 
+       /* allow only one option at a time */
+       if ((cfg.disable + cfg.enable + cfg.status) > 1) {
+
+               fprintf(stderr, "ERROR : WDC : Invalid option\n");
+               ret = -1;
+               goto out;
+       }
+
        if (cfg.disable) {
                ret = nvme_set_feature(fd, 0, WDC_VU_DISABLE_CNTLR_TELEMETRY_OPTION_FEATURE_ID, 1,
                                       0, 0, 0, buf, &result);