Skip to contentSkip to conversation

vhost: fix return code for log_access_ok()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 11, 2010 – Oct 12, 2010

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 vhost: fix return code for log_access_ok()

access_ok() returns 1 if it's OK otherwise it should return 0.

drivers/vhost/vhost.c +1 -1
index c2aa12c..f82fe57 100644
@@ -371,7 +371,7 @@ static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
 	/* Make sure 64 bit math will not overflow. */
 	if (a > ULONG_MAX - (unsigned long)log_base ||
 	    a + (unsigned long)log_base > ULONG_MAX)
-		return -EFAULT;
+		return 0;
 
 	return access_ok(VERIFY_WRITE, log_base + a,
 			 (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);
maintainer Acked-by on v1 2/2
#1 lore raw
Quoted 3 lines · Dan Carpenter

access_ok() returns 1 if it's OK otherwise it should return 0.

Good catch, thanks!

Quoted 13 lines
drivers/vhost/vhost.c +1 -1
index c2aa12c..f82fe57 100644
@@ -371,7 +371,7 @@ static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
 	/* Make sure 64 bit math will not overflow. */
 	if (a > ULONG_MAX - (unsigned long)log_base ||
 	    a + (unsigned long)log_base > ULONG_MAX)
-		return -EFAULT;
+		return 0;
 
 	return access_ok(VERIFY_WRITE, log_base + a,
 			 (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);