mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 10:01:59 -06:00
vfio/common: Fix wrong %m usages
There are several places where the %m conversion is used if one of vfio_dma_map(), vfio_dma_unmap() or vfio_get_dirty_bitmap() fail. The %m usage in these places is wrong since %m relies on errno value while the above functions don't report errors via errno. Fix it by using strerror() with the returned value instead. Signed-off-by: Avihai Horon <avihaih@nvidia.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20230307125450.62409-3-joao.m.martins@oracle.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
3e2413a652
commit
db9b829b15
1 changed files with 16 additions and 13 deletions
|
@ -703,17 +703,17 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
|
||||||
read_only);
|
read_only);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
|
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx", %p) = %d (%m)",
|
"0x%"HWADDR_PRIx", %p) = %d (%s)",
|
||||||
container, iova,
|
container, iova,
|
||||||
iotlb->addr_mask + 1, vaddr, ret);
|
iotlb->addr_mask + 1, vaddr, ret, strerror(-ret));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = vfio_dma_unmap(container, iova, iotlb->addr_mask + 1, iotlb);
|
ret = vfio_dma_unmap(container, iova, iotlb->addr_mask + 1, iotlb);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx") = %d (%m)",
|
"0x%"HWADDR_PRIx") = %d (%s)",
|
||||||
container, iova,
|
container, iova,
|
||||||
iotlb->addr_mask + 1, ret);
|
iotlb->addr_mask + 1, ret, strerror(-ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -1095,8 +1095,9 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
||||||
vaddr, section->readonly);
|
vaddr, section->readonly);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_setg(&err, "vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
|
error_setg(&err, "vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx", %p) = %d (%m)",
|
"0x%"HWADDR_PRIx", %p) = %d (%s)",
|
||||||
container, iova, int128_get64(llsize), vaddr, ret);
|
container, iova, int128_get64(llsize), vaddr, ret,
|
||||||
|
strerror(-ret));
|
||||||
if (memory_region_is_ram_device(section->mr)) {
|
if (memory_region_is_ram_device(section->mr)) {
|
||||||
/* Allow unexpected mappings not to be fatal for RAM devices */
|
/* Allow unexpected mappings not to be fatal for RAM devices */
|
||||||
error_report_err(err);
|
error_report_err(err);
|
||||||
|
@ -1228,16 +1229,18 @@ static void vfio_listener_region_del(MemoryListener *listener,
|
||||||
ret = vfio_dma_unmap(container, iova, int128_get64(llsize), NULL);
|
ret = vfio_dma_unmap(container, iova, int128_get64(llsize), NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx") = %d (%m)",
|
"0x%"HWADDR_PRIx") = %d (%s)",
|
||||||
container, iova, int128_get64(llsize), ret);
|
container, iova, int128_get64(llsize), ret,
|
||||||
|
strerror(-ret));
|
||||||
}
|
}
|
||||||
iova += int128_get64(llsize);
|
iova += int128_get64(llsize);
|
||||||
}
|
}
|
||||||
ret = vfio_dma_unmap(container, iova, int128_get64(llsize), NULL);
|
ret = vfio_dma_unmap(container, iova, int128_get64(llsize), NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx") = %d (%m)",
|
"0x%"HWADDR_PRIx") = %d (%s)",
|
||||||
container, iova, int128_get64(llsize), ret);
|
container, iova, int128_get64(llsize), ret,
|
||||||
|
strerror(-ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1384,9 +1387,9 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
|
||||||
translated_addr);
|
translated_addr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", "
|
error_report("vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", "
|
||||||
"0x%"HWADDR_PRIx") = %d (%m)",
|
"0x%"HWADDR_PRIx") = %d (%s)",
|
||||||
container, iova,
|
container, iova, iotlb->addr_mask + 1, ret,
|
||||||
iotlb->addr_mask + 1, ret);
|
strerror(-ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue