Re: [RESEND][PATCH 1/7] powerpc/iommu: Avoid overflow at boundary_size

2020-09-01 Thread Nicolin Chen
On Tue, Sep 01, 2020 at 11:27:36PM +1000, Michael Ellerman wrote: > Nicolin Chen writes: > > The boundary_size might be as large as ULONG_MAX, which means > > that a device has no specific boundary limit. So either "+ 1" > > or passing it to ALIGN() would potentially overflow. > > > > According to

Re: [RESEND][PATCH 1/7] powerpc/iommu: Avoid overflow at boundary_size

2020-09-01 Thread Michael Ellerman
Nicolin Chen writes: > The boundary_size might be as large as ULONG_MAX, which means > that a device has no specific boundary limit. So either "+ 1" > or passing it to ALIGN() would potentially overflow. > > According to kernel defines: > #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))

[RESEND][PATCH 1/7] powerpc/iommu: Avoid overflow at boundary_size

2020-08-31 Thread Nicolin Chen
The boundary_size might be as large as ULONG_MAX, which means that a device has no specific boundary limit. So either "+ 1" or passing it to ALIGN() would potentially overflow. According to kernel defines: #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define ALIGN(x, a) ALIGN_MAS