summaryrefslogtreecommitdiffstats
path: root/hw/nvme
diff options
context:
space:
mode:
authorKlaus Jensen2021-08-09 12:34:40 +0200
committerKlaus Jensen2021-08-09 12:52:16 +0200
commit5f4884c4412318a1adc105dea9cc28f7625ce730 (patch)
tree85caaa206cf09b9d9b3a750c901e1fca0563a47f /hw/nvme
parentMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-re... (diff)
downloadqemu-5f4884c4412318a1adc105dea9cc28f7625ce730.tar.gz
qemu-5f4884c4412318a1adc105dea9cc28f7625ce730.tar.xz
qemu-5f4884c4412318a1adc105dea9cc28f7625ce730.zip
hw/nvme: fix missing variable initializers
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>
Diffstat (limited to 'hw/nvme')
-rw-r--r--hw/nvme/ctrl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 43dfaeac9f..6baf9e0420 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -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);