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

[Xen-devel] [PATCH v4 09/34] vmap: ASSERT on NULL.



The vmap_to_page macro (three levels deep!) can come up with
a NULL pointer. Lets add the proper ASSERT to catch this errant
behavior.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

---
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Keir Fraser <keir@xxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
---
---
 xen/common/vmap.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index be01285..1f1da1b 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -279,8 +279,12 @@ void vfree(void *va)
     ASSERT(pages);
 
     for ( i = 0; i < pages; i++ )
-        page_list_add(vmap_to_page(va + i * PAGE_SIZE), &pg_list);
+    {
+        struct page_info *page = vmap_to_page(va + i * PAGE_SIZE);
 
+        ASSERT(page);
+        page_list_add(page, &pg_list);
+    }
     vunmap(va);
 
     while ( (pg = page_list_remove_head(&pg_list)) != NULL )
-- 
2.5.0


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

 


Rackspace

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