linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: remove kvm_read_hva and kvm_read_hva_atomic
@ 2015-04-02 12:08 Paolo Bonzini
  2015-04-03  4:07 ` Xiao Guangrong
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2015-04-02 12:08 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Xiao Guangrong

The corresponding write functions just use __copy_to_user.  Do the
same on the read side.

This reverts what's left of commit 86ab8cffb498 (KVM: introduce
gfn_to_hva_read/kvm_read_hva/kvm_read_hva_atomic, 2012-08-21)

Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a1093700f3a4..c772c31a87bb 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1193,16 +1193,6 @@ unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable)
 	return gfn_to_hva_memslot_prot(slot, gfn, writable);
 }
 
-static int kvm_read_hva(void *data, void __user *hva, int len)
-{
-	return __copy_from_user(data, hva, len);
-}
-
-static int kvm_read_hva_atomic(void *data, void __user *hva, int len)
-{
-	return __copy_from_user_inatomic(data, hva, len);
-}
-
 static int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
 	unsigned long start, int write, struct page **page)
 {
@@ -1554,7 +1544,7 @@ int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
 	addr = gfn_to_hva_prot(kvm, gfn, NULL);
 	if (kvm_is_error_hva(addr))
 		return -EFAULT;
-	r = kvm_read_hva(data, (void __user *)addr + offset, len);
+	r = __copy_from_user(data, (void __user *)addr + offset, len);
 	if (r)
 		return -EFAULT;
 	return 0;
@@ -1593,7 +1583,7 @@ int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
 	if (kvm_is_error_hva(addr))
 		return -EFAULT;
 	pagefault_disable();
-	r = kvm_read_hva_atomic(data, (void __user *)addr + offset, len);
+	r = __copy_from_user_inatomic(data, (void __user *)addr + offset, len);
 	pagefault_enable();
 	if (r)
 		return -EFAULT;
-- 
2.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: remove kvm_read_hva and kvm_read_hva_atomic
  2015-04-02 12:08 [PATCH] KVM: remove kvm_read_hva and kvm_read_hva_atomic Paolo Bonzini
@ 2015-04-03  4:07 ` Xiao Guangrong
  0 siblings, 0 replies; 2+ messages in thread
From: Xiao Guangrong @ 2015-04-03  4:07 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm



On 04/02/2015 08:08 PM, Paolo Bonzini wrote:
> The corresponding write functions just use __copy_to_user.  Do the
> same on the read side.
>
> This reverts what's left of commit 86ab8cffb498 (KVM: introduce
> gfn_to_hva_read/kvm_read_hva/kvm_read_hva_atomic, 2012-08-21)
>

It looks good to me.

Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-03  4:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 12:08 [PATCH] KVM: remove kvm_read_hva and kvm_read_hva_atomic Paolo Bonzini
2015-04-03  4:07 ` Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).