linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: KVM: Return directly after a failed copy_from_user() in kvm_arch_vcpu_ioctl()
@ 2017-01-18 19:52 SF Markus Elfring
  2017-01-19  9:50 ` Paolo Bonzini
  2017-01-19 11:13 ` [PATCH] " kbuild test robot
  0 siblings, 2 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-01-18 19:52 UTC (permalink / raw)
  To: kvm, linux-mips, James Hogan, Paolo Bonzini,
	Radim Krčmář,
	Ralf Bächle
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Jan 2017 20:43:41 +0100

Return directly after a call of the function "copy_from_user" failed
in a case block.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/mips/kvm/mips.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index 06a60b19acfb..1dad78f74e8c 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -1152,10 +1152,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl,
 		{
 			struct kvm_mips_interrupt irq;
 
-			r = -EFAULT;
 			if (copy_from_user(&irq, argp, sizeof(irq)))
-				goto out;
-
+				return -EFAULT;
 			kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__,
 				  irq.irq);
 
@@ -1165,9 +1163,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl,
 	case KVM_ENABLE_CAP: {
 		struct kvm_enable_cap cap;
 
-		r = -EFAULT;
 		if (copy_from_user(&cap, argp, sizeof(cap)))
-			goto out;
+			return -EFAULT;
 		r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap);
 		break;
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-19 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18 19:52 [PATCH] MIPS: KVM: Return directly after a failed copy_from_user() in kvm_arch_vcpu_ioctl() SF Markus Elfring
2017-01-19  9:50 ` Paolo Bonzini
2017-01-19 10:20   ` [PATCH v2] " SF Markus Elfring
2017-01-19 10:27     ` Paolo Bonzini
2017-01-19 12:08       ` James Hogan
2017-01-19 11:13 ` [PATCH] " kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).