qemu-e2k/hw/vfio
Alexey Kardashevskiy 79178edd2a vfio/spapr: Fix page size calculation
Coverity detected an issue (CID 1421903) with potential call of clz64(0)
which returns 64 which make it do "<<" with a negative number.

This checks the mask and avoids undefined behaviour.

In practice pgsizes and memory_region_iommu_get_min_page_size() always
have some common page sizes and even if they did not, the resulting page
size would be 0x8000.0000.0000.0000 (gcc 9.2) and
ioctl(VFIO_IOMMU_SPAPR_TCE_CREATE) would fail anyway.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20200324063912.25063-1-aik@ozlabs.ru>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-04-07 08:55:10 +10:00
..
amd-xgbe.c
ap.c
calxeda-xgmac.c
ccw.c
common.c Report stringified errno in VFIO related errors 2020-02-18 20:20:49 +01:00
display.c hw/vfio/display: Remove superfluous semicolon 2020-02-18 20:20:49 +01:00
igd.c
Kconfig
Makefile.objs
pci-quirks.c
pci.c
pci.h
platform.c
spapr.c vfio/spapr: Fix page size calculation 2020-04-07 08:55:10 +10:00
trace-events