The name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use address_space_get_path() instead.
Signed-off-by: Akihiko Odaki <od...@rsg.ci.i.u-tokyo.ac.jp> --- hw/vfio/listener.c | 8 ++++++-- hw/virtio/vhost-vdpa.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index f498e23a9374..d0418db28c8b 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -137,9 +137,11 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) iova, iova + iotlb->addr_mask); if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); + error_setg(&local_err, "Wrong target AS \"%s\", only system memory is allowed", - iotlb->target_as->name ? iotlb->target_as->name : "none"); + path); if (migration_is_running()) { migration_file_set_error(-EINVAL, local_err); } else { @@ -1060,9 +1062,11 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask); if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); + error_setg(&local_err, "Wrong target AS \"%s\", only system memory is allowed", - iotlb->target_as->name ? iotlb->target_as->name : "none"); + path); goto out; } diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7061b6e1a386..7ed639358458 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -213,8 +213,10 @@ static void vhost_vdpa_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) hwaddr xlat; if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); + error_report("Wrong target AS \"%s\", only system memory is allowed", - iotlb->target_as->name ? iotlb->target_as->name : "none"); + path); return; } RCU_READ_LOCK_GUARD(); -- 2.51.0