Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71a7d3d7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Williamson
Browse files

vfio/type1: silence integer overflow warning



I get a static checker warning about the potential integer overflow if
we add "unmap->iova + unmap->size".  The integer overflow isn't really
harmful, but we may as well fix it.  Also unmap->size gets truncated to
size_t when we pass it to vfio_find_dma() so we could check for too high
values of that as well.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 79d40370
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -767,6 +767,9 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu,
		return -EINVAL;
	if (!unmap->size || unmap->size & mask)
		return -EINVAL;
	if (unmap->iova + unmap->size < unmap->iova ||
	    unmap->size > SIZE_MAX)
		return -EINVAL;

	WARN_ON(mask & PAGE_MASK);
again: