On 2017年03月30日 05:26, Michael S. Tsirkin wrote:
On Wed, Mar 29, 2017 at 02:12:50PM +0800, Jason Wang wrote:
We return int64_t as the length of region cache but accept hwaddr as
the required length. This is wrong and may confuse the caller since
the it can lead comparison between signed and unsigned types. The
caller can not catch the failure in this case. Fixing this by
returning hwaddr and return zero on failure.
Fixes: 5eba0404b9829 ("virtio: use MemoryRegionCache to access descriptors")
Fixes: e45da65322386 ("virtio: validate address space cache during init")
Cc: Cornelia Huck<cornelia.h...@de.ibm.com>
Cc: Paolo Bonzini<pbonz...@redhat.com>
Signed-off-by: Jason Wang<jasow...@redhat.com>
Can you be more specific about the symptoms this fixes in the
commit log?
E.g. "This actually triggers on XYZ when using ABC".
I want do this, but in fact this was triggered by a bug of qemu (see the
thread of iommu reset vs region cache).
In that case, when used map fails, then check
if (len < size) {
virtio_error(vdev, "Cannot map used");
goto err_used;
}
can not catch the -EFAULT, since len is converted to unsigned.
Thanks