public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	linux390@de.ibm.com, Gleb Natapov <gleb@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] KVM: s390: return -EFAULT if copy_from_user() fails
Date: Mon, 05 May 2014 09:30:31 +0200	[thread overview]
Message-ID: <53673E17.6040705@de.ibm.com> (raw)
In-Reply-To: <20140503201811.GA32753@mwanda>

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
> 


      reply	other threads:[~2014-05-05  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53673E17.6040705@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gleb@kernel.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox