From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Tiwei Bie <tiwei.bie@intel.com>
Subject: [Qemu-devel] [PULL 1/5] vhost: check region type before casting
Date: Fri, 3 Aug 2018 12:27:57 +0300 [thread overview]
Message-ID: <20180803083830.775669-2-mst@redhat.com> (raw)
In-Reply-To: <20180803083830.775669-1-mst@redhat.com>
From: Tiwei Bie <tiwei.bie@intel.com>
Check region type first before casting the memory region
to IOMMUMemoryRegion. Otherwise QEMU will abort with below
error message when casting non-IOMMU memory region:
vhost_iommu_region_add: Object 0x561f28bce4f0 is not an
instance of type qemu:iommu-memory-region
Fixes: cb1efcf462a2 ("iommu: Add IOMMU index argument to notifier APIs")
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/vhost.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
MST
next prev parent reply other threads:[~2018-08-03 9:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 9:27 [Qemu-devel] [PULL 0/5] pc, virtio: fixes Michael S. Tsirkin
2018-08-03 9:27 ` Michael S. Tsirkin [this message]
2018-08-03 9:27 ` [Qemu-devel] [PULL 2/5] hw/acpi-build: Add a check for memory-less NUMA nodes Michael S. Tsirkin
2018-08-03 9:28 ` [Qemu-devel] [PULL 3/5] tests/acpi-test: update ACPI tables test blobs Michael S. Tsirkin
2018-08-03 9:28 ` [Qemu-devel] [PULL 4/5] pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size Michael S. Tsirkin
2018-08-03 9:28 ` [Qemu-devel] [PULL 5/5] tests/acpi: update tables after memory hotplug changes Michael S. Tsirkin
2018-08-03 10:45 ` [Qemu-devel] [PULL 0/5] pc, virtio: fixes Peter Maydell
2018-08-03 18:14 ` Michael S. Tsirkin
2018-08-06 8:37 ` Peter Maydell
2018-08-06 9:47 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180803083830.775669-2-mst@redhat.com \
--to=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tiwei.bie@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.