aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2023-10-04 13:48:09 +0200
committerMarkus Armbruster <armbru@redhat.com>2023-10-06 12:47:57 +0200
commitda3182887cd3d3d02c3406549818cf222a9f0ca1 (patch)
treec70da490d4562d7d857633148ca39482f838226b /hw
parent5ae80e6297080b3592b4658d92acfdba5255fc8b (diff)
downloadqemu-da3182887cd3d3d02c3406549818cf222a9f0ca1.zip
qemu-da3182887cd3d3d02c3406549818cf222a9f0ca1.tar.gz
qemu-da3182887cd3d3d02c3406549818cf222a9f0ca1.tar.bz2
hw/virtio/vhost: Silence compiler warnings in vhost code when using -Wshadow
Rename a variable in vhost_dev_sync_region() and remove a superfluous declaration in vhost_commit() to make this code compilable with "-Wshadow". Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20231004114809.105672-1-thuth@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-By: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/vhost.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index e2f6ffb..9cfac40 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -66,12 +66,12 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
uint64_t mfirst, uint64_t mlast,
uint64_t rfirst, uint64_t rlast)
{
- vhost_log_chunk_t *log = dev->log->log;
+ vhost_log_chunk_t *dev_log = dev->log->log;
uint64_t start = MAX(mfirst, rfirst);
uint64_t end = MIN(mlast, rlast);
- vhost_log_chunk_t *from = log + start / VHOST_LOG_CHUNK;
- vhost_log_chunk_t *to = log + end / VHOST_LOG_CHUNK + 1;
+ vhost_log_chunk_t *from = dev_log + start / VHOST_LOG_CHUNK;
+ vhost_log_chunk_t *to = dev_log + end / VHOST_LOG_CHUNK + 1;
uint64_t addr = QEMU_ALIGN_DOWN(start, VHOST_LOG_CHUNK);
if (end < start) {
@@ -549,7 +549,7 @@ static void vhost_commit(MemoryListener *listener)
changed = true;
} else {
/* Same size, lets check the contents */
- for (int i = 0; i < n_old_sections; i++) {
+ for (i = 0; i < n_old_sections; i++) {
if (!MemoryRegionSection_eq(&old_sections[i],
&dev->mem_sections[i])) {
changed = true;