[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 May 2020 14:17:52 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Yan Zhao <yan.y.zhao@...el.com>,
Alex Williamson <alex.williamson@...hat.com>
Subject: Re: [PATCH 4.19 21/37] vfio: avoid possible overflow in
vfio_iommu_type1_pin_pages
On Mon 2020-05-04 19:57:34, Greg Kroah-Hartman wrote:
> From: Yan Zhao <yan.y.zhao@...el.com>
>
> commit 0ea971f8dcd6dee78a9a30ea70227cf305f11ff7 upstream.
>
> add parentheses to avoid possible vaddr overflow.
AFAICT the values are unsigned, so yes, this is nice cleanup, but it
does not really fix any problem, right? IOW it overflows, then
underflows, but the result is still correct...
Best regards,
Pavel
> Fixes: a54eb55045ae ("vfio iommu type1: Add support for mediated devices")
> Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
> Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>
> ---
> drivers/vfio/vfio_iommu_type1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -598,7 +598,7 @@ static int vfio_iommu_type1_pin_pages(vo
> continue;
> }
>
> - remote_vaddr = dma->vaddr + iova - dma->iova;
> + remote_vaddr = dma->vaddr + (iova - dma->iova);
> ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i],
> do_accounting);
> if (ret)
>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists