Skip to content

Commit

Permalink
hw/virtio/vhost: Silence compiler warnings in vhost code when using -…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
huth authored and Markus Armbruster committed Oct 6, 2023
1 parent 5ae80e6 commit da31828
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hw/virtio/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit da31828

Please sign in to comment.