vhost-net: fix vq_memory_access_ok error checking

vq_memory_access_ok needs to check whether mem == NULL

Signed-off-by: Jeff Dike <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
This commit is contained in:
Jeff Dike 2010-04-07 09:59:10 -04:00 • committed by Michael S. Tsirkin
commit 179b284e2f

View file

@ -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;