]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
hw/nvme: fix missing variable initializers
authorKlaus Jensen <k.jensen@samsung.com>
Mon, 9 Aug 2021 10:34:40 +0000 (12:34 +0200)
committerKlaus Jensen <k.jensen@samsung.com>
Mon, 9 Aug 2021 10:52:16 +0000 (12:52 +0200)
Coverity found that 'uuid', 'csi' and 'eui64' are uninitialized. While
we set most of the fields, we do not explicitly set the rsvd2 field in
the NvmeIdNsDescr header.

Fix this by explicitly zero-initializing the variables.

Reported-by: Coverity (CID 1458835, 1459295 and 1459580)
Fixes: 6870cfb8140d ("hw/nvme: namespace parameter for EUI-64")
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
hw/nvme/ctrl.c

index 43dfaeac9f544757b933dc6e7829139e9e1c2347..6baf9e0420d5b19971a0b59c02fef868f31f77d4 100644 (file)
@@ -4663,15 +4663,15 @@ static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req)
     struct {
         NvmeIdNsDescr hdr;
         uint8_t v[NVME_NIDL_UUID];
-    } QEMU_PACKED uuid;
+    } QEMU_PACKED uuid = {};
     struct {
         NvmeIdNsDescr hdr;
         uint64_t v;
-    } QEMU_PACKED eui64;
+    } QEMU_PACKED eui64 = {};
     struct {
         NvmeIdNsDescr hdr;
         uint8_t v;
-    } QEMU_PACKED csi;
+    } QEMU_PACKED csi = {};
 
     trace_pci_nvme_identify_ns_descr_list(nsid);