[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aOaFqZ5cPgeRyoNS@devgpu015.cco6.facebook.com>
Date: Wed, 8 Oct 2025 08:39:21 -0700
From: Alex Mastro <amastro@...com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: Alex Williamson <alex.williamson@...hat.com>,
Alejandro Jimenez
<alejandro.j.jimenez@...cle.com>,
<kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/3] vfio/type1: sanitize for overflow using
check_*_overflow
On Wed, Oct 08, 2025 at 09:19:30AM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 07, 2025 at 09:08:46PM -0700, Alex Mastro wrote:
> > + if (check_mul_overflow(npage, PAGE_SIZE, &iova_size))
> > + return -EINVAL;
>
> -EOVERFLOW and everywhere else
>
> > +
> > + if (check_add_overflow(user_iova, iova_size - 1, &iova_end))
> > + return -EINVAL;
>
> Let's be consistent with iommufd/etc, 'end' is start+size 'last' is start+size-1
>
> Otherwise it is super confusing :(
Both suggestions SGTM.
Powered by blists - more mailing lists