On Sat, Jul 02, 2016 at 09:23:24PM -0300, Aaron Campbell wrote:
> Per VT-d spec Section 10.4.2 ("Capability Register"), the maximum
> number of possible domains is 64K; indeed this is the maximum value
> that the cap_ndoms() macro will expand to.

Good catch. Before 3bd4f9112f87, the loop ended at the fixed value
0xffff. I didn't notice that cap_ndoms() could not only be lower than
that, like on my notebook, but could also be greater. Therefore I didn't
even look at the type of 'did'.

So, strictly speaking, the original code would not only overflow for
small values of cap_ndoms, but would miss the entry at 0xffff in case
cap_ndoms was 0x10000. My patch unfortunately changed that to an endless
loop, instead.

Jan

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to