[PATCH] Fix vq_memory_access_ok error checking

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff Dike
Date: Tuesday, April 6, 2010 - 1:14 pm

Here's another small patch fixing an error path...

			Jeff

-- 
Work email - jdike at linux dot intel dot com


commit 7938779d9f357ede8bc3c122fd0dc9d5ec4fcf1d
Author: Jeff Dike <jdike@addtoit.com>
Date:   Wed Mar 31 15:05:08 2010 -0400

    vq_memory_access_ok needs to check whether mem == NULL

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 7bd7a1e..b8e1127 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -235,6 +235,10 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
 			       int log_all)
 {
 	int i;
+
+        if (!mem)
+                return 0;
+
 	for (i = 0; i < mem->nregions; ++i) {
 		struct vhost_memory_region *m = mem->regions + i;
 		unsigned long a = m->userspace_addr;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix vq_memory_access_ok error checking, Jeff Dike, (Tue Apr 6, 1:14 pm)
Re: [PATCH] Fix vq_memory_access_ok error checking, Michael S. Tsirkin, (Wed Apr 7, 12:49 am)