From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Gonglei <arei.gonglei@huawei.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PULL 5/5] virtio-crypto: fix uninitialized variables
Date: Thu, 1 Dec 2016 05:58:54 +0200 [thread overview]
Message-ID: <1480564455-23933-6-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1480564455-23933-1-git-send-email-mst@redhat.com>
From: Gonglei <arei.gonglei@huawei.com>
Though crypto_cfg.reserve is an unused field, let me
initialize the structure in order to make coverity happy.
*** CID 1365923: Uninitialized variables (UNINIT)
/hw/virtio/virtio-crypto.c: 851 in virtio_crypto_get_config()
845 stl_le_p(&crypto_cfg.mac_algo_h, c->conf.mac_algo_h);
846 stl_le_p(&crypto_cfg.aead_algo, c->conf.aead_algo);
847 stl_le_p(&crypto_cfg.max_cipher_key_len, c->conf.max_cipher_key_len);
848 stl_le_p(&crypto_cfg.max_auth_key_len, c->conf.max_auth_key_len);
849 stq_le_p(&crypto_cfg.max_size, c->conf.max_size);
850
>>> CID 1365923: Uninitialized variables (UNINIT)
>>> Using uninitialized value "crypto_cfg". Field "crypto_cfg.reserve"
is uninitialized when calling "memcpy".
[Note: The source code implementation of the function
has been overridden by a builtin model.]
851 memcpy(config, &crypto_cfg, c->config_size);
852 }
853
Rported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 847dc9d..2f2467e 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -838,7 +838,7 @@ static Property virtio_crypto_properties[] = {
static void virtio_crypto_get_config(VirtIODevice *vdev, uint8_t *config)
{
VirtIOCrypto *c = VIRTIO_CRYPTO(vdev);
- struct virtio_crypto_config crypto_cfg;
+ struct virtio_crypto_config crypto_cfg = {};
/*
* Virtio-crypto device conforms to VIRTIO 1.0 which is always LE,
--
MST
next prev parent reply other threads:[~2016-12-01 3:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 3:58 [Qemu-devel] [PULL 0/5] virtio, vhost, pc: fixes Michael S. Tsirkin
2016-12-01 3:58 ` [Qemu-devel] [PULL 1/5] spec/vhost-user: fix the VHOST_USER prefix Michael S. Tsirkin
2016-12-01 3:58 ` [Qemu-devel] [PULL 2/5] intel_iommu: fix incorrect device invalidate Michael S. Tsirkin
2016-12-01 3:58 ` [Qemu-devel] [PULL 3/5] loader: fix handling of custom address spaces when adding ROM blobs Michael S. Tsirkin
2016-12-01 3:58 ` [Qemu-devel] [PULL 4/5] loader: fix undefined behavior in rom_order_compare() Michael S. Tsirkin
2016-12-01 3:58 ` Michael S. Tsirkin [this message]
2016-12-01 13:39 ` [Qemu-devel] [PULL 0/5] virtio, vhost, pc: fixes Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480564455-23933-6-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).