From: Randy Date: Wed, 18 Mar 2020 18:44:59 +0000 (-0500) Subject: Allow only one option value at a time X-Git-Tag: v1.11~8^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d2dc3cdf3f349688a38a52b419d9b096ceae40e3;p=users%2Fhch%2Fnvme-cli.git Allow only one option value at a time --- diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 2735214..ad86fde 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -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);