Differential D3854 Diff 9274 emulators/xen-kernel/files/0002-vmap-avoid-hitting-an-ASSERT-with-vfree-NULL.patch
Changeset View
Changeset View
Standalone View
Standalone View
emulators/xen-kernel/files/0002-vmap-avoid-hitting-an-ASSERT-with-vfree-NULL.patch
- This file was added.
From ed4a7917a6faa8b7e8f211eaeda270f96e45de7d Mon Sep 17 00:00:00 2001 | |||||
From: Andrew Cooper <andrew.cooper3@citrix.com> | |||||
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 <wei.liu2@citrix.com> | |||||
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> | |||||
Tested-by: Wei Liu <wei.liu2@citrix.com> | |||||
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> | |||||
Acked-by: Tim Deegan <tim@xen.org> | |||||
--- | |||||
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) | |||||