aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-05-15 11:22:04 -0400
committerAvi Kivity <avi@redhat.com>2011-07-12 04:45:03 -0400
commit8b0cedff040b652f3d36b1368778667581b0c140 (patch)
treed1a8d8c7368d96830a0b4d6af7aa652ab5a015d6 /virt/kvm
parent332b207d65c1d7982489dbb83e5071c95e19eb75 (diff)
KVM: use __copy_to_user/__clear_user to write guest page
Simply use __copy_to_user/__clear_user to write guest page since we have already verified the user address when the memslot is set Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 96ebc0679415..087b3f8ca46e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1345,7 +1345,7 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
1345 addr = gfn_to_hva(kvm, gfn); 1345 addr = gfn_to_hva(kvm, gfn);
1346 if (kvm_is_error_hva(addr)) 1346 if (kvm_is_error_hva(addr))
1347 return -EFAULT; 1347 return -EFAULT;
1348 r = copy_to_user((void __user *)addr + offset, data, len); 1348 r = __copy_to_user((void __user *)addr + offset, data, len);
1349 if (r) 1349 if (r)
1350 return -EFAULT; 1350 return -EFAULT;
1351 mark_page_dirty(kvm, gfn); 1351 mark_page_dirty(kvm, gfn);
@@ -1405,7 +1405,7 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
1405 if (kvm_is_error_hva(ghc->hva)) 1405 if (kvm_is_error_hva(ghc->hva))
1406 return -EFAULT; 1406 return -EFAULT;
1407 1407
1408 r = copy_to_user((void __user *)ghc->hva, data, len); 1408 r = __copy_to_user((void __user *)ghc->hva, data, len);
1409 if (r) 1409 if (r)
1410 return -EFAULT; 1410 return -EFAULT;
1411 mark_page_dirty_in_slot(kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT); 1411 mark_page_dirty_in_slot(kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT);