aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-02-23 04:25:23 -0500
committerMichael S. Tsirkin <mst@redhat.com>2010-02-28 12:42:36 -0500
commitd6db3f5c11dc7ed5712d5d5682aa34025ee5248e (patch)
tree30d7c7dd5987be4185943de23db686027e1a0867 /drivers/vhost
parent73a99f083009d67d8e12603420e008d5c21b0b7d (diff)
vhost: fix get_user_pages_fast error handling
get_user_pages_fast returns number of pages on success, negative value on failure, but never 0. Fix vhost code to match this logic. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vhost.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 6c31c0c9bbb9..7cd55e078794 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -646,8 +646,9 @@ static int set_bit_to_user(int nr, void __user *addr)
646 int bit = nr + (log % PAGE_SIZE) * 8; 646 int bit = nr + (log % PAGE_SIZE) * 8;
647 int r; 647 int r;
648 r = get_user_pages_fast(log, 1, 1, &page); 648 r = get_user_pages_fast(log, 1, 1, &page);
649 if (r) 649 if (r < 0)
650 return r; 650 return r;
651 BUG_ON(r != 1);
651 base = kmap_atomic(page, KM_USER0); 652 base = kmap_atomic(page, KM_USER0);
652 set_bit(bit, base); 653 set_bit(bit, base);
653 kunmap_atomic(base, KM_USER0); 654 kunmap_atomic(base, KM_USER0);