All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/vmap: Avoid hitting an ASSERT with vfree(NULL)
@ 2015-05-20 15:57 Andrew Cooper
  2015-05-20 16:26 ` Tim Deegan
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2015-05-20 15:57 UTC (permalink / raw)
  To: Xen-devel
  Cc: Keir Fraser, Andrew Cooper, Tim Deegan, Jan Beulich, Wei Liu,
	Roger Pau Monné

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>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: 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 8752595..ac66a8c 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.7.10.4


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xen/vmap: Avoid hitting an ASSERT with vfree(NULL)
  2015-05-20 15:57 [PATCH] xen/vmap: Avoid hitting an ASSERT with vfree(NULL) Andrew Cooper
@ 2015-05-20 16:26 ` Tim Deegan
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2015-05-20 16:26 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Keir Fraser, Roger Pau Monné, Wei Liu, Jan Beulich, Xen-devel

At 16:57 +0100 on 20 May (1432141031), Andrew Cooper wrote:
> 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>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Tim Deegan <tim@xen.org>

Acked-by: Tim Deegan <tim@xen.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-20 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 15:57 [PATCH] xen/vmap: Avoid hitting an ASSERT with vfree(NULL) Andrew Cooper
2015-05-20 16:26 ` Tim Deegan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.