Re: [PATCH 1/2] iommu: debug-pagealloc: Check map overflow in a phys_addr_t

From: Mostafa Saleh

Date: Tue Dec 01 2026 - 07:23:03 EST


On Tue, Dec 1, 2026 at 1:15 PM Mostafa Saleh <smostafa@xxxxxxxxxx> wrote:
>
> On Tue, Dec 01, 2026 at 11:57:45AM +0100, Jörg Rödel wrote:
> > On Mon, Nov 30, 2026 at 04:46:27PM +0000, Mostafa Saleh wrote:
> > > void __iommu_debug_map(struct iommu_domain *domain, phys_addr_t phys, size_t size)
> > > {
> > > - size_t off, end;
> > > + size_t off;
> > > + phys_addr_t end;
> > > size_t page_size = iommu_debug_page_size(domain);
> >
> > The __iommu_debug_update_iova() function has the same bug.
>
> Sorry I missed that, I will respin.
>

Looking into it, this case is slightly different,
__iommu_debug_update_iova() adds iova (unsigned long) and size
(size_t) into a size_t. All three have the same width.

We can change the end to “unsigned long” for consistency but that
won’t change the behaviour.
Also, looking into other IOMMU code, overflow checks should use "size
-1" instead of "size" so that a range ending at the top of the address
space is not reported as an overflow.

I will fix that for v2.

Thanks,
Mostafa

> Thanks,
> Mostafa
>
> >
> > -Joerg