]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: Bug fix default data_len used if no argument given
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Tue, 3 Aug 2021 04:47:13 +0000 (13:47 +0900)
committerDaniel Wagner <dwagner@suse.de>
Mon, 15 Nov 2021 11:06:29 +0000 (12:06 +0100)
current logic ignore given data by user
so make priority to use user argument first

this change make available vendor specific command on set-feature, get-feature with data_len

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 3815ef86eb38d40995e04a23b6933bd302e7d2db..5c7f61918f85032f9f48001e585571390594109e 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2734,7 +2734,9 @@ ret:
 static int get_feature_id(int fd, struct feat_cfg *cfg, void **buf,
                          __u32 *result)
 {
-       nvme_get_feature_length(cfg->feature_id, cfg->cdw11, &cfg->data_len);
+       if (!cfg->data_len)
+               nvme_get_feature_length(cfg->feature_id, cfg->cdw11,
+                                       &cfg->data_len);
 
        /* check for Extended Host Identifier */
        if (cfg->feature_id == NVME_FEAT_FID_HOST_ID && (cfg->cdw11 & 0x1))