* [PATCH] intel_iommu: Fix shadow local variables on "size"
@ 2023-09-22 16:04 Peter Xu
2023-09-22 18:17 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Xu @ 2023-09-22 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: peterx, Jason Wang, Eric Auger, Michael S . Tsirkin,
Markus Armbruster
This patch fixes the warning of shadowed local variable:
../hw/i386/intel_iommu.c: In function ‘vtd_address_space_unmap’:
../hw/i386/intel_iommu.c:3773:18: warning: declaration of ‘size’ shadows a previous local [-Wshadow=compatible-local]
3773 | uint64_t size = mask + 1;
| ^~~~
../hw/i386/intel_iommu.c:3747:12: note: shadowed declaration is here
3747 | hwaddr size, remain;
| ^~~~
Cc: Jason Wang <jasowang@redhat.com>
Cc: Eric Auger <eric.auger@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/i386/intel_iommu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index c9961ef752..ae30c2b469 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,
/* Unmap the whole range in the notifier's scope. */
static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
{
- hwaddr size, remain;
+ hwaddr total, remain;
hwaddr start = n->start;
hwaddr end = n->end;
IntelIOMMUState *s = as->iommu_state;
@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
}
assert(start <= end);
- size = remain = end - start + 1;
+ total = remain = end - start + 1;
while (remain >= VTD_PAGE_SIZE) {
IOMMUTLBEvent event;
@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
VTD_PCI_SLOT(as->devfn),
VTD_PCI_FUNC(as->devfn),
- n->start, size);
+ n->start, total);
map.iova = n->start;
- map.size = size - 1; /* Inclusive */
+ map.size = total - 1; /* Inclusive */
iova_tree_remove(as->iova_tree, map);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] intel_iommu: Fix shadow local variables on "size"
2023-09-22 16:04 [PATCH] intel_iommu: Fix shadow local variables on "size" Peter Xu
@ 2023-09-22 18:17 ` Philippe Mathieu-Daudé
2023-09-22 21:15 ` Michael S. Tsirkin
2023-09-29 6:47 ` Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-22 18:17 UTC (permalink / raw)
To: Peter Xu, qemu-devel
Cc: Jason Wang, Eric Auger, Michael S . Tsirkin, Markus Armbruster
On 22/9/23 18:04, Peter Xu wrote:
> This patch fixes the warning of shadowed local variable:
>
> ../hw/i386/intel_iommu.c: In function ‘vtd_address_space_unmap’:
> ../hw/i386/intel_iommu.c:3773:18: warning: declaration of ‘size’ shadows a previous local [-Wshadow=compatible-local]
> 3773 | uint64_t size = mask + 1;
> | ^~~~
> ../hw/i386/intel_iommu.c:3747:12: note: shadowed declaration is here
> 3747 | hwaddr size, remain;
> | ^~~~
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> hw/i386/intel_iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] intel_iommu: Fix shadow local variables on "size"
2023-09-22 16:04 [PATCH] intel_iommu: Fix shadow local variables on "size" Peter Xu
2023-09-22 18:17 ` Philippe Mathieu-Daudé
@ 2023-09-22 21:15 ` Michael S. Tsirkin
2023-09-29 6:47 ` Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-09-22 21:15 UTC (permalink / raw)
To: Peter Xu; +Cc: qemu-devel, Jason Wang, Eric Auger, Markus Armbruster
On Fri, Sep 22, 2023 at 12:04:10PM -0400, Peter Xu wrote:
> This patch fixes the warning of shadowed local variable:
>
> ../hw/i386/intel_iommu.c: In function ‘vtd_address_space_unmap’:
> ../hw/i386/intel_iommu.c:3773:18: warning: declaration of ‘size’ shadows a previous local [-Wshadow=compatible-local]
> 3773 | uint64_t size = mask + 1;
> | ^~~~
> ../hw/i386/intel_iommu.c:3747:12: note: shadowed declaration is here
> 3747 | hwaddr size, remain;
> | ^~~~
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/i386/intel_iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index c9961ef752..ae30c2b469 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,
> /* Unmap the whole range in the notifier's scope. */
> static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
> {
> - hwaddr size, remain;
> + hwaddr total, remain;
> hwaddr start = n->start;
> hwaddr end = n->end;
> IntelIOMMUState *s = as->iommu_state;
> @@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
> }
>
> assert(start <= end);
> - size = remain = end - start + 1;
> + total = remain = end - start + 1;
>
> while (remain >= VTD_PAGE_SIZE) {
> IOMMUTLBEvent event;
> @@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
> trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
> VTD_PCI_SLOT(as->devfn),
> VTD_PCI_FUNC(as->devfn),
> - n->start, size);
> + n->start, total);
>
> map.iova = n->start;
> - map.size = size - 1; /* Inclusive */
> + map.size = total - 1; /* Inclusive */
> iova_tree_remove(as->iova_tree, map);
> }
>
> --
> 2.41.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] intel_iommu: Fix shadow local variables on "size"
2023-09-22 16:04 [PATCH] intel_iommu: Fix shadow local variables on "size" Peter Xu
2023-09-22 18:17 ` Philippe Mathieu-Daudé
2023-09-22 21:15 ` Michael S. Tsirkin
@ 2023-09-29 6:47 ` Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2023-09-29 6:47 UTC (permalink / raw)
To: Peter Xu
Cc: qemu-devel, Jason Wang, Eric Auger, Michael S . Tsirkin,
Markus Armbruster
Peter Xu <peterx@redhat.com> writes:
> This patch fixes the warning of shadowed local variable:
>
> ../hw/i386/intel_iommu.c: In function ‘vtd_address_space_unmap’:
> ../hw/i386/intel_iommu.c:3773:18: warning: declaration of ‘size’ shadows a previous local [-Wshadow=compatible-local]
> 3773 | uint64_t size = mask + 1;
> | ^~~~
> ../hw/i386/intel_iommu.c:3747:12: note: shadowed declaration is here
> 3747 | hwaddr size, remain;
> | ^~~~
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Queued, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-29 6:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 16:04 [PATCH] intel_iommu: Fix shadow local variables on "size" Peter Xu
2023-09-22 18:17 ` Philippe Mathieu-Daudé
2023-09-22 21:15 ` Michael S. Tsirkin
2023-09-29 6:47 ` Markus Armbruster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).