]> xenbits.xensource.com Git - xen.git/commitdiff
vmap: ASSERT on NULL
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 17 Mar 2016 12:48:24 +0000 (13:48 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 17 Mar 2016 12:48:24 +0000 (13:48 +0100)
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@oracle.com>
xen/common/vmap.c

index c57239ff0aa5c654c7f9af0c45265f81336ab0f1..134eda08d6d7f501defbe1a5cda3e20743bf9d1a 100644 (file)
@@ -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 )