From ed4a7917a6faa8b7e8f211eaeda270f96e45de7d Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Fri, 9 Oct 2015 12:57:31 +0200 Subject: [PATCH 2/8] vmap: avoid hitting an ASSERT with vfree(NULL) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and unconditionally defer the vm_size() call, as it doesn't have a NULL short circuit. Reported-by: Wei Liu Signed-off-by: Andrew Cooper Tested-by: Wei Liu Reviewed-by: Roger Pau Monné Acked-by: Tim Deegan --- 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 b6827b5..9028802 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -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++ ) -- 1.9.5 (Apple Git-50.3)