Re: [PATCH v2] iommu/iommufd: avoid selftest dirty bitmap size wrap
From: Samuel Moelius
Date: Wed Jun 10 2026 - 15:03:11 EST
On Wed, Jun 10, 2026 at 12:37 PM Jason Gunthorpe <jgg@xxxxxxxx> wrote:
>
> On Wed, Jun 10, 2026 at 12:23:52AM +0000, Samuel Moelius wrote:
>
> > @@ -1705,6 +1707,13 @@ static int iommufd_test_dirty(struct iommufd_ucmd *ucmd, unsigned int mockpt_id,
> > goto out_put;
> > }
> >
> > + if (check_mul_overflow((unsigned long)SZ_16M, page_size, &max_length))
> > + max_length = ULONG_MAX;
>
> You should never have a cast in a check_.._overflow like this.
>
> Also just fail, something is really wrong if page size is so large
> this doesn't succeed.
I am getting ready to travel and I will address this when I return in
about two weeks. Thank you for understanding.