All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/11] KVM: ARM/arm64: return -EFAULT if copy_from_user fails in set_timer_reg
Date: Tue, 26 Aug 2014 15:22:34 +0100	[thread overview]
Message-ID: <53FC982A.3050600@arm.com> (raw)
In-Reply-To: <1409062410-25891-5-git-send-email-will.deacon@arm.com>

On 26/08/14 15:13, Will Deacon wrote:
> We currently return the number of bytes not copied if set_timer_reg
> fails, which is almost certainly not what userspace would like.
> 
> This patch returns -EFAULT instead.
> 
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

> ---
>  arch/arm/kvm/guest.c   | 2 +-
>  arch/arm64/kvm/guest.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
> index 813e49258690..cc0b78769bd8 100644
> --- a/arch/arm/kvm/guest.c
> +++ b/arch/arm/kvm/guest.c
> @@ -163,7 +163,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>  
>  	ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
>  	if (ret != 0)
> -		return ret;
> +		return -EFAULT;
>  
>  	return kvm_arm_timer_set_reg(vcpu, reg->id, val);
>  }
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 8d1ec2887a26..76794692c20b 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -174,7 +174,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>  
>  	ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
>  	if (ret != 0)
> -		return ret;
> +		return -EFAULT;
>  
>  	return kvm_arm_timer_set_reg(vcpu, reg->id, val);
>  }
> 


-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2014-08-26 14:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 14:13 [PATCH 00/11] Fix arm64 issues highlighted by sparse and smatch Will Deacon
2014-08-26 14:13 ` [PATCH 01/11] KVM: ARM/arm64: fix non-const declaration of function returning const Will Deacon
2014-08-26 14:21   ` Marc Zyngier
2014-08-26 14:29   ` Christoffer Dall
2014-08-26 14:13 ` [PATCH 02/11] KVM: ARM/arm64: fix broken __percpu annotation Will Deacon
2014-08-26 14:21   ` Marc Zyngier
2014-08-26 14:13 ` [PATCH 03/11] KVM: ARM/arm64: avoid returning negative error code as bool Will Deacon
2014-08-26 14:22   ` Marc Zyngier
2014-08-26 14:49   ` Christoffer Dall
2014-08-26 14:13 ` [PATCH 04/11] KVM: ARM/arm64: return -EFAULT if copy_from_user fails in set_timer_reg Will Deacon
2014-08-26 14:22   ` Marc Zyngier [this message]
2014-08-26 14:49   ` Christoffer Dall
2014-08-26 14:13 ` [PATCH 05/11] KVM: vgic: return int instead of bool when checking I/O ranges Will Deacon
2014-08-26 14:27   ` Marc Zyngier
2014-08-26 14:49   ` Christoffer Dall
2014-08-26 14:13 ` [PATCH 06/11] KVM: vgic: declare probe function pointer as const Will Deacon
2014-08-26 14:27   ` Marc Zyngier
2014-08-26 14:50   ` Christoffer Dall
2014-08-26 14:13 ` [PATCH 07/11] irqchip: gic: make gic_default_routable_irq_domain_ops static Will Deacon
2014-08-26 14:29   ` Marc Zyngier
2014-08-26 14:13 ` [PATCH 08/11] irqchip: gic-v3: declare rdist as __percpu pointer to __iomem pointer Will Deacon
2014-08-26 14:29   ` Marc Zyngier
2014-08-26 14:13 ` [PATCH 09/11] arm64: ptrace: fix compat hardware watchpoint reporting Will Deacon
2014-08-26 14:13 ` [PATCH 10/11] arm64: ptrace: fix compat reg getter/setter return values Will Deacon
2014-08-26 14:13 ` [PATCH 11/11] arm64: perf: don't rely on layout of pt_regs when grabbing sp or pc Will Deacon
2014-08-26 14:43   ` Jean Pihet
2014-08-26 14:56 ` [PATCH 00/11] Fix arm64 issues highlighted by sparse and smatch Christoffer Dall
2014-08-26 17:05   ` Will Deacon
2014-08-27 20:58     ` Christoffer Dall
2014-09-03 12:10 ` Jason Cooper

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=53FC982A.3050600@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.