diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 979bff485fb0..a9dd682cf5e3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1064,10 +1064,12 @@ EXPORT_SYMBOL_GPL(gfn_to_hva); | |||
1064 | unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable) | 1064 | unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable) |
1065 | { | 1065 | { |
1066 | struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); | 1066 | struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); |
1067 | if (writable) | 1067 | unsigned long hva = __gfn_to_hva_many(slot, gfn, NULL, false); |
1068 | |||
1069 | if (!kvm_is_error_hva(hva) && writable) | ||
1068 | *writable = !memslot_is_readonly(slot); | 1070 | *writable = !memslot_is_readonly(slot); |
1069 | 1071 | ||
1070 | return __gfn_to_hva_many(gfn_to_memslot(kvm, gfn), gfn, NULL, false); | 1072 | return hva; |
1071 | } | 1073 | } |
1072 | 1074 | ||
1073 | static int kvm_read_hva(void *data, void __user *hva, int len) | 1075 | static int kvm_read_hva(void *data, void __user *hva, int len) |