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

[Xen-devel] [PATCH] x86/mm: Fix infinite loop in get_spage_pages()



c/s 2b8eb37 switched int i to being unsigned, but the undo logic on failure
relied in i being signed.  As i being unsigned in still preforable, adjust the
undo logic to work with an unsigned i.

Coverity-ID: 1413017
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b20f37f..19f672d 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2687,7 +2687,7 @@ static int get_spage_pages(struct page_info *page, struct 
domain *d)
     {
         if ( !get_page_and_type(page, d, PGT_writable_page) )
         {
-            while ( --i >= 0 )
+            while ( i-- > 0 )
                 put_page_and_type(--page);
             return 0;
         }
-- 
2.1.4


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

 


Rackspace

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