diff options
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 4c256d15c249..38244f59cdd9 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -882,15 +882,15 @@ static int set_bit_to_user(int nr, void __user *addr) | |||
882 | static int log_write(void __user *log_base, | 882 | static int log_write(void __user *log_base, |
883 | u64 write_address, u64 write_length) | 883 | u64 write_address, u64 write_length) |
884 | { | 884 | { |
885 | u64 write_page = write_address / VHOST_PAGE_SIZE; | ||
885 | int r; | 886 | int r; |
886 | if (!write_length) | 887 | if (!write_length) |
887 | return 0; | 888 | return 0; |
888 | write_length += write_address % VHOST_PAGE_SIZE; | 889 | write_length += write_address % VHOST_PAGE_SIZE; |
889 | write_address /= VHOST_PAGE_SIZE; | ||
890 | for (;;) { | 890 | for (;;) { |
891 | u64 base = (u64)(unsigned long)log_base; | 891 | u64 base = (u64)(unsigned long)log_base; |
892 | u64 log = base + write_address / 8; | 892 | u64 log = base + write_page / 8; |
893 | int bit = write_address % 8; | 893 | int bit = write_page % 8; |
894 | if ((u64)(unsigned long)log != log) | 894 | if ((u64)(unsigned long)log != log) |
895 | return -EFAULT; | 895 | return -EFAULT; |
896 | r = set_bit_to_user(bit, (void __user *)(unsigned long)log); | 896 | r = set_bit_to_user(bit, (void __user *)(unsigned long)log); |
@@ -899,7 +899,7 @@ static int log_write(void __user *log_base, | |||
899 | if (write_length <= VHOST_PAGE_SIZE) | 899 | if (write_length <= VHOST_PAGE_SIZE) |
900 | break; | 900 | break; |
901 | write_length -= VHOST_PAGE_SIZE; | 901 | write_length -= VHOST_PAGE_SIZE; |
902 | write_address += 1; | 902 | write_page += 1; |
903 | } | 903 | } |
904 | return r; | 904 | return r; |
905 | } | 905 | } |