OSDN Git Service

hw/block/nvme: fix set feature save field check
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Sun, 24 Jan 2021 15:35:32 +0000 (21:05 +0530)
committerKlaus Jensen <k.jensen@samsung.com>
Mon, 8 Feb 2021 20:15:54 +0000 (21:15 +0100)
Currently, no features are saveable, so the current check is not wrong,
but add a check against the feature capabilities to make sure this will
not regress if saveable features are added later.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme.c

index b3d072c..c99a3fb 100644 (file)
@@ -3324,7 +3324,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
 
     trace_pci_nvme_setfeat(nvme_cid(req), nsid, fid, save, dw11);
 
-    if (save) {
+    if (save && !(nvme_feature_cap[fid] & NVME_FEAT_CAP_SAVE)) {
         return NVME_FID_NOT_SAVEABLE | NVME_DNR;
     }