* [PATCH] hw/nvme: fix missing variable initializers
@ 2021-08-09 10:43 Klaus Jensen
2021-08-09 10:47 ` [PATCH-for-6.1?] " Philippe Mathieu-Daudé
0 siblings, 1 reply; 3+ messages in thread
From: Klaus Jensen @ 2021-08-09 10:43 UTC (permalink / raw)
To: qemu-devel
Cc: Keith Busch, Klaus Jensen, Peter Maydell, qemu-block,
Klaus Jensen
From: Klaus Jensen <k.jensen@samsung.com>
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>
---
hw/nvme/ctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 43dfaeac9f54..6baf9e0420d5 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);
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH-for-6.1?] hw/nvme: fix missing variable initializers
2021-08-09 10:43 [PATCH] hw/nvme: fix missing variable initializers Klaus Jensen
@ 2021-08-09 10:47 ` Philippe Mathieu-Daudé
2021-08-09 10:51 ` Klaus Jensen
0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-09 10:47 UTC (permalink / raw)
To: Klaus Jensen, qemu-devel
Cc: Keith Busch, Peter Maydell, qemu-block, Klaus Jensen
On 8/9/21 12:43 PM, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> 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>
> ---
> hw/nvme/ctrl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH-for-6.1?] hw/nvme: fix missing variable initializers
2021-08-09 10:47 ` [PATCH-for-6.1?] " Philippe Mathieu-Daudé
@ 2021-08-09 10:51 ` Klaus Jensen
0 siblings, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2021-08-09 10:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Keith Busch, Peter Maydell, qemu-devel, qemu-block, Klaus Jensen
[-- Attachment #1: Type: text/plain, Size: 891 bytes --]
On Aug 9 12:47, Philippe Mathieu-Daudé wrote:
> On 8/9/21 12:43 PM, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> >
> > 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>
> > ---
> > hw/nvme/ctrl.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
Swift as always Philippe, thanks!
Yes, I'll PR this for -rc3 immediately.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-09 10:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-09 10:43 [PATCH] hw/nvme: fix missing variable initializers Klaus Jensen
2021-08-09 10:47 ` [PATCH-for-6.1?] " Philippe Mathieu-Daudé
2021-08-09 10:51 ` Klaus Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).