Re: [PATCH v2] iommu/iommufd: avoid selftest dirty bitmap size wrap

From: Jason Gunthorpe

Date: Wed Jun 10 2026 - 12:47:50 EST


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.

Jason