summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-05-03 23:18:11 +0300
committerChristian Borntraeger <borntraeger@de.ibm.com>2014-05-06 14:57:59 +0200
commitfcc9aec3de0a1d00cbce47f7274ec0c62122266b (patch)
tree2dd17d25be679f006f3ecad0eccab57fc376db94
parent57b5981cd38cbca3554c5e663b2361d9adea70c2 (diff)
downloadlinux-fcc9aec3de0a1d00cbce47f7274ec0c62122266b.tar.gz
linux-fcc9aec3de0a1d00cbce47f7274ec0c62122266b.tar.bz2
linux-fcc9aec3de0a1d00cbce47f7274ec0c62122266b.zip
KVM: s390: return -EFAULT if copy_from_user() fails
When copy_from_user() fails, this code returns the number of bytes remaining instead of a negative error code. The positive number is returned to the user but otherwise it is harmless. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/kvm/guestdbg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index 757ccef62fd5..3e8d4092ce30 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -223,9 +223,10 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
goto error;
}
- ret = copy_from_user(bp_data, dbg->arch.hw_bp, size);
- if (ret)
+ if (copy_from_user(bp_data, dbg->arch.hw_bp, size)) {
+ ret = -EFAULT;
goto error;
+ }
for (i = 0; i < dbg->arch.nr_hw_bp; i++) {
switch (bp_data[i].type) {