* [patch] KVM: s390: return -EFAULT if copy_from_user() fails
@ 2014-05-03 20:18 Dan Carpenter
2014-05-05 7:30 ` Christian Borntraeger
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-05-03 20:18 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Cornelia Huck, linux390, Gleb Natapov, Paolo Bonzini,
Martin Schwidefsky, Heiko Carstens, linux-s390, kvm,
kernel-janitors
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>
---
I am not able to compile this.
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index 757ccef..3e8d409 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) {
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] KVM: s390: return -EFAULT if copy_from_user() fails
2014-05-03 20:18 [patch] KVM: s390: return -EFAULT if copy_from_user() fails Dan Carpenter
@ 2014-05-05 7:30 ` Christian Borntraeger
0 siblings, 0 replies; 2+ messages in thread
From: Christian Borntraeger @ 2014-05-05 7:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: Cornelia Huck, linux390, Gleb Natapov, Paolo Bonzini,
Martin Schwidefsky, Heiko Carstens, linux-s390, kvm,
kernel-janitors
On 03/05/14 22:18, Dan Carpenter wrote:
> 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>
Thanks. Applied to KVM/s390 fix queue.
> ---
> I am not able to compile this.
>
> diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
> index 757ccef..3e8d409 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) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-s390" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-05 7:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-03 20:18 [patch] KVM: s390: return -EFAULT if copy_from_user() fails Dan Carpenter
2014-05-05 7:30 ` Christian Borntraeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox