aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-05-11 20:03:16 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-05-12 00:03:57 +0200
commit5b3ca87079e7a356ba0036ebb0be0a37def35e38 (patch)
tree9ddc43a499954fb7638afece144d1829f2065340
parent1e6b638b490918386292e79efc8f62311e4a9f2f (diff)
downloadpasst-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar.gz
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar.bz2
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar.lz
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar.xz
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.tar.zst
passt-5b3ca87079e7a356ba0036ebb0be0a37def35e38.zip
virtio: Reduce scope of variable
As cppcheck points out, the 'min' variable in vu_log_queue_fill() can have its scope reduced. Do so. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--virtio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virtio.c b/virtio.c
index b283de6..d7016cc 100644
--- a/virtio.c
+++ b/virtio.c
@@ -630,9 +630,9 @@ static void vu_log_queue_fill(const struct vu_dev *vdev, struct vu_virtq *vq,
{
struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE];
struct vring_desc *desc = vq->vring.desc;
- unsigned int max, min;
unsigned num_bufs = 0;
uint64_t read_len;
+ unsigned int max;
if (!vdev->log_table || !len || !vu_has_feature(vdev, VHOST_F_LOG_ALL))
return;
@@ -672,7 +672,7 @@ static void vu_log_queue_fill(const struct vu_dev *vdev, struct vu_virtq *vq,
die("Looped descriptor");
if (le16toh(desc[index].flags) & VRING_DESC_F_WRITE) {
- min = MIN(le32toh(desc[index].len), len);
+ unsigned min = MIN(le32toh(desc[index].len), len);
vu_log_write(vdev, le64toh(desc[index].addr), min);
len -= min;
}