summaryrefslogtreecommitdiff
path: root/hw/virtio/vhost.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio/vhost.c')
-rw-r--r--hw/virtio/vhost.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index b129cb9ddd..d4cb5894a8 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -663,12 +663,14 @@ static void vhost_iommu_region_add(MemoryListener *listener,
struct vhost_iommu *iommu;
Int128 end;
int iommu_idx;
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+ IOMMUMemoryRegion *iommu_mr;
if (!memory_region_is_iommu(section->mr)) {
return;
}
+ iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+
iommu = g_malloc0(sizeof(*iommu));
end = int128_add(int128_make64(section->offset_within_region),
section->size);