From d2dc3cdf3f349688a38a52b419d9b096ceae40e3 Mon Sep 17 00:00:00 2001 From: Randy Date: Wed, 18 Mar 2020 13:44:59 -0500 Subject: [PATCH] Allow only one option value at a time --- plugins/wdc/wdc-nvme.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.49.0