A variable containing a guest frame should be compared to INVALID_GFN
and not INVALID_MFN.

Signed-off-by: Julien Grall <julien.gr...@arm.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com>
Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>

---
Cc: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>

    Changes in v6:
        - Fix typo in the commit message
        - Add Andrew's and Jan' reviewed-by

    Changes in v5:
        - Patch added
---
 xen/drivers/passthrough/amd/iommu_map.c | 2 +-
 xen/drivers/passthrough/x86/iommu.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_map.c 
b/xen/drivers/passthrough/amd/iommu_map.c
index 1b914ba..c758459 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -555,7 +555,7 @@ static int update_paging_mode(struct domain *d, unsigned 
long gfn)
     unsigned long old_root_mfn;
     struct domain_iommu *hd = dom_iommu(d);
 
-    if ( gfn == INVALID_MFN )
+    if ( gfn == INVALID_GFN )
         return -EADDRNOTAVAIL;
     ASSERT(!(gfn >> DEFAULT_DOMAIN_ADDRESS_WIDTH));
 
diff --git a/xen/drivers/passthrough/x86/iommu.c 
b/xen/drivers/passthrough/x86/iommu.c
index a18a608..cd435d7 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -61,7 +61,7 @@ int arch_iommu_populate_page_table(struct domain *d)
             unsigned long mfn = page_to_mfn(page);
             unsigned long gfn = mfn_to_gmfn(d, mfn);
 
-            if ( gfn != INVALID_MFN )
+            if ( gfn != INVALID_GFN )
             {
                 ASSERT(!(gfn >> DEFAULT_DOMAIN_ADDRESS_WIDTH));
                 BUG_ON(SHARED_M2P(gfn));
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to