]> git.baikalelectronics.ru Git - kernel.git/commit
vfio/type1: fix unmap all on ILP32
authorSteve Sistare <steven.sistare@oracle.com>
Thu, 25 Feb 2021 19:25:02 +0000 (11:25 -0800)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 16 Mar 2021 16:39:27 +0000 (10:39 -0600)
commit89a0161e59486b14da60d11f170958d77dbe1c09
treebb7f3e5cc64e0c07232bc8293507782dbe455d56
parent4f0be5a267ce1c80d673727864ba230cec2dd40b
vfio/type1: fix unmap all on ILP32

Some ILP32 architectures support mapping a 32-bit vaddr within a 64-bit
iova space.  The unmap-all code uses 32-bit SIZE_MAX as an upper bound on
the extent of the mappings within iova space, so mappings above 4G cannot
be found and unmapped.  Use U64_MAX instead, and use u64 for size variables.
This also fixes a static analysis bug found by the kernel test robot running
smatch for ILP32.

Fixes: 28789ae61e2b ("vfio/type1: unmap cleanup")
Fixes: 7a1d4efd30df ("vfio/type1: implement unmap all")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Message-Id: <1614281102-230747-1-git-send-email-steven.sistare@oracle.com>
Link: https://lore.kernel.org/linux-mm/20210222141043.GW2222@kadam
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c