Message ID | 1474658051-18617-5-git-send-email-mst@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index fcf3358..bb656b1 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -495,6 +495,11 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iove } iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write); + if (!iov[num_sg].iov_base) { + error_report("virtio: bogus descriptor or out of resources"); + exit(1); + } + iov[num_sg].iov_len = len; addr[num_sg] = pa;