]> git.proxmox.com Git - mirror_qemu.git/commitdiff
intel_iommu: vtd_slpt_level_shift check level
authorPeter Xu <peterx@redhat.com>
Tue, 7 Feb 2017 08:28:11 +0000 (16:28 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 17 Feb 2017 19:52:31 +0000 (21:52 +0200)
This helps in debugging incorrect level passed in.

Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/intel_iommu.c

index ad304f681c7677d6a1db9cf138f0f095300c61dc..22d8226e43e85a0dbea7b159816b2fb7555ceb36 100644 (file)
@@ -168,6 +168,7 @@ static gboolean vtd_hash_remove_by_domain(gpointer key, gpointer value,
 /* The shift of an addr for a certain level of paging structure */
 static inline uint32_t vtd_slpt_level_shift(uint32_t level)
 {
+    assert(level != 0);
     return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_SL_LEVEL_BITS;
 }