[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] iommu/x86: fix IVMD/RMRR range checker loop increment



commit d9bfc2810e1cbe4cd27555bdc48315d36ee91f14
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Feb 14 14:18:06 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 14 14:18:06 2024 +0100

    iommu/x86: fix IVMD/RMRR range checker loop increment
    
    mfn_add() doesn't store the incremented value in the parameter, and instead
    returns it to the caller.  As a result, the loop in iommu_unity_region_ok()
    didn't make progress.  Fix it by storing the incremented value.
    
    Fixes: e45801dea17b ('iommu/x86: introduce a generic IVMD/RMRR range 
validity helper')
    Coverity-ID: 1592056
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/passthrough/x86/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/iommu.c 
b/xen/drivers/passthrough/x86/iommu.c
index 1c8cf3271a..a3fa0aef7c 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -804,7 +804,7 @@ bool __init iommu_unity_region_ok(const char *prefix, mfn_t 
start, mfn_t end)
            "%s: [%#" PRI_mfn " ,%#" PRI_mfn "] is not (entirely) in reserved 
memory\n",
            prefix, mfn_x(start), mfn_x(end));
 
-    for ( addr = start; mfn_x(addr) <= mfn_x(end); mfn_add(addr, 1) )
+    for ( addr = start; mfn_x(addr) <= mfn_x(end); addr = mfn_add(addr, 1) )
     {
         unsigned int type = page_get_ram_type(addr);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.