mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessandro Zanni <alessandro.zanni87@gmail.com>
To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
	eperezma@redhat.com
Cc: Alessandro Zanni <alessandro.zanni87@gmail.com>,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org, anupnewsmail@gmail.com
Subject: [PATCH] virtio: Fixes errors: uninitialized symbol
Date: Fri, 27 Sep 2024 17:53:27 +0200	[thread overview]
Message-ID: <20240927155330.450702-1-alessandro.zanni87@gmail.com> (raw)

This fix solves multiple Smatch static checker uninitialized errors:

drivers/virtio/virtio_ring.c:1516 virtqueue_add_packed()
error: uninitialized symbol 'prev'.

drivers/virtio/virtio_ring.c:1524 virtqueue_add_packed()
error: uninitialized symbol 'head_flags'.

drivers/virtio/virtio_ring.c:645 virtqueue_add_split()
error: uninitialized symbol 'prev'.

Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
 drivers/virtio/virtio_ring.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index be7309b1e860..001ea503d52c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -553,7 +553,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
 	struct vring_virtqueue *vq = to_vvq(_vq);
 	struct scatterlist *sg;
 	struct vring_desc *desc;
-	unsigned int i, n, avail, descs_used, prev, err_idx;
+	unsigned int i, n, avail, descs_used, prev = 0, err_idx;
 	int head;
 	bool indirect;
 
@@ -1411,8 +1411,8 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq,
 	struct vring_packed_desc *desc;
 	struct scatterlist *sg;
 	unsigned int i, n, c, descs_used, err_idx;
-	__le16 head_flags, flags;
-	u16 head, id, prev, curr, avail_used_flags;
+	__le16 head_flags = 0, flags;
+	u16 head, id, prev = 0, curr, avail_used_flags;
 	int err;
 
 	START_USE(vq);
-- 
2.43.0


                 reply	other threads:[~2024-09-27 15:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240927155330.450702-1-alessandro.zanni87@gmail.com \
    --to=alessandro.zanni87@gmail.com \
    --cc=anupnewsmail@gmail.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=skhan@linuxfoundation.org \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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

all inboxes | Powered by JetHome®