AMD/IOMMU: correct potentially-UB shifts
authorJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:21:10 +0000 (12:21 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:21:10 +0000 (12:21 +0200)
commitd029b9cf13875823532ee6e4201421dba16c81d4
tree1939372fcae68230af4337fcb04a5bab4c9d6916
parent444b555dc9e09fa3ce90f066e0c88dec9b47f422
AMD/IOMMU: correct potentially-UB shifts

Recent changes (likely 5fafa6cf529a ["AMD/IOMMU: have callers specify
the target level for page table walks"]) have made Coverity notice a
shift count in iommu_pde_from_dfn() which might in theory grow too
large. While this isn't a problem in practice, address the concern
nevertheless to not leave dangling breakage in case very large
superpages would be enabled at some point.

Coverity ID: 1504264

While there also address a similar issue in set_iommu_ptes_present().
It's not clear to me why Coverity hasn't spotted that one.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/amd/iommu_map.c