Skip to contentSkip to conversation

xen/vmap: Avoid hitting an ASSERT with vfree(NULL)

PATCH In review Andrew Cooper 2 participants 2 messages May 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/vmap: Avoid hitting an ASSERT with vfree(NULL)

and unconditionally defer the vm_size() call, as it doesn't have a NULL short circuit.

---
 xen/common/vmap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
xen/common/vmap.c +5 -1
index 8752595..ac66a8c 100644
@@ -268,10 +268,14 @@ void *vzalloc(size_t size)
 
 void vfree(void *va)
 {
-    unsigned int i, pages = vm_size(va);
+    unsigned int i, pages;
     struct page_info *pg;
     PAGE_LIST_HEAD(pg_list);
 
+    if ( !va )
+        return;
+
+    pages = vm_size(va);
     ASSERT(pages);
 
     for ( i = 0; i < pages; i++ )
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrew Cooper

and unconditionally defer the vm_size() call, as it doesn't have a NULL short circuit.