libvhost-user: Fix compiler warning with -Wshadow=local
PATCH 1/1 libvhost-user: Fix compiler warning with -Wshadow=local
Rename shadowing variables to make this code compilable with -Wshadow=local.
Signed-off-by Thomas Huth <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
subprojects/libvhost-user/libvhost-user.c +6 -6
@@ -870,10 +870,10 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {for (i =0 ; i < dev->nregions; i++) {if (reg_equal (&dev->regions[i], msg_region)) {VuDevRegion *r = &dev->regions[i]; -void *m = (void *) (uintptr_t ) r->mmap_addr; +void *ma = (void *) (uintptr_t ) r->mmap_addr; -if (m) { -munmap (m, r->size + r->mmap_offset); +if (ma) { +munmap (ma, r->size + r->mmap_offset); }/*
@@ -1005,10 +1005,10 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)for (i =0 ; i < dev->nregions; i++) {VuDevRegion *r = &dev->regions[i]; -void *m = (void *) (uintptr_t ) r->mmap_addr; +void *ma = (void *) (uintptr_t ) r->mmap_addr; -if (m) { -munmap (m, r->size + r->mmap_offset); +if (ma) { +munmap (ma, r->size + r->mmap_offset); } } dev->nregions = memory->nregions;
Signature · 1 line
2.41.0
Quoted 4 lines · Thomas Huth
Rename shadowing variables to make this code compilable with -Wshadow=local.
Signed-off-by Thomas Huth <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>
Quoted 38 lines
--- subprojects/libvhost-user/libvhost-user.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)subprojects/libvhost-user/libvhost-user.c +6
-6@@ -870,10 +870,10 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {for (i =0 ; i < dev->nregions; i++) {if (reg_equal (&dev->regions[i], msg_region)) {VuDevRegion *r = &dev->regions[i]; -void *m = (void *) (uintptr_t ) r->mmap_addr; +void *ma = (void *) (uintptr_t ) r->mmap_addr; -if (m) { -munmap (m, r->size + r->mmap_offset); +if (ma) { +munmap (ma, r->size + r->mmap_offset); }/* @@ -1005,10 +1005,10 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)for (i =0 ; i < dev->nregions; i++) {VuDevRegion *r = &dev->regions[i]; -void *m = (void *) (uintptr_t ) r->mmap_addr; +void *ma = (void *) (uintptr_t ) r->mmap_addr; -if (m) { -munmap (m, r->size + r->mmap_offset); +if (ma) { +munmap (ma, r->size + r->mmap_offset); } } dev->nregions = memory->nregions;Signature · 1 line
2.41.0
Markus Armbruster
AppliedQuoted 4 lines · Thomas Huth
Rename shadowing variables to make this code compilable with -Wshadow=local.
Signed-off-by Thomas Huth <[email protected]>
Queued. Thanks!