提交 6d97e55f 编写于 作者: D Dan Carpenter 提交者: Michael S. Tsirkin

vhost: fix return code for log_access_ok()

access_ok() returns 1 if it's OK otherwise it should return 0.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 b0057c51
...@@ -371,7 +371,7 @@ static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) ...@@ -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. */ /* Make sure 64 bit math will not overflow. */
if (a > ULONG_MAX - (unsigned long)log_base || if (a > ULONG_MAX - (unsigned long)log_base ||
a + (unsigned long)log_base > ULONG_MAX) a + (unsigned long)log_base > ULONG_MAX)
return -EFAULT; return 0;
return access_ok(VERIFY_WRITE, log_base + a, return access_ok(VERIFY_WRITE, log_base + a,
(sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册