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>
This commit is contained in:
Dan Carpenter 2014-05-03 23:18:11 +03:00 committed by Christian Borntraeger
parent 57b5981cd3
commit fcc9aec3de
1 changed files with 3 additions and 2 deletions

View File

@ -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) {