]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: fix timestamp feature in set feature
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Thu, 25 Mar 2021 19:41:35 +0000 (01:11 +0530)
committerKeith Busch <kbusch@kernel.org>
Wed, 31 Mar 2021 21:48:17 +0000 (15:48 -0600)
In Timestamp feature structure size is 8 bytes, since the 6th
and 7th bytes are reserved no need to change the data len
parameter to 6 bytes.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 5e77e3f643f3d3114c11ba8529fb7a082a2951ba..bea1a266b15387c7cfec87f627ab6fb248193c1f 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3606,8 +3606,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
 
        if (buf) {
          /* if feature ID is 0x0E, get timestamp value by -v option */
-        if ((NVME_FEAT_TIMESTAMP == cfg.feature_id) &&  (0 != cfg.value)) {
-            cfg.data_len = NVME_FEAT_TIMESTAMP_DATA_SIZE;
+        if (NVME_FEAT_TIMESTAMP == cfg.feature_id && cfg.value) {
             memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE);
         }
         else {
@@ -3631,7 +3630,6 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
             if (NVME_FEAT_TIMESTAMP == cfg.feature_id) {
                 number = strtoul(buf, &endptr, STRTOUL_AUTO_BASE);
                 memset(buf, 0, cfg.data_len);
-                cfg.data_len = NVME_FEAT_TIMESTAMP_DATA_SIZE;
                 memcpy(buf, &number, NVME_FEAT_TIMESTAMP_DATA_SIZE);
             }
         }