diff options
-rw-r--r-- | drivers/kvm/x86_emulate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 7513cddb929f..bcf872bdaf74 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -833,8 +833,9 @@ done_prefixes: | |||
833 | dst.ptr = (unsigned long *)cr2; | 833 | dst.ptr = (unsigned long *)cr2; |
834 | dst.bytes = (d & ByteOp) ? 1 : op_bytes; | 834 | dst.bytes = (d & ByteOp) ? 1 : op_bytes; |
835 | if (d & BitOp) { | 835 | if (d & BitOp) { |
836 | dst.ptr += src.val / BITS_PER_LONG; | 836 | unsigned long mask = ~(dst.bytes * 8 - 1); |
837 | dst.bytes = sizeof(long); | 837 | |
838 | dst.ptr = (void *)dst.ptr + (src.val & mask) / 8; | ||
838 | } | 839 | } |
839 | if (!(d & Mov) && /* optimisation - avoid slow emulated read */ | 840 | if (!(d & Mov) && /* optimisation - avoid slow emulated read */ |
840 | ((rc = ops->read_emulated((unsigned long)dst.ptr, | 841 | ((rc = ops->read_emulated((unsigned long)dst.ptr, |