Patchworkβ KVM: x86: Fix KVM_GET_CLOCK

login
register
about
Submitter Jan Kiszka
Date 2009-11-03 11:49:05
Message ID <4AF018B1.5080801@siemens.com>
Download mbox | patch
Permalink /patch/57279/
State New
Headers show

Comments

Jan Kiszka - 2009-11-03 11:49:05
The flags field of kvm_clock_data is supposed to indicate the
availability of additional fields one day. There are none yet, so clear
it. Moreover, drop the bogus check of this field and return 0 on
success.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Note: This replaces "Clear flags field on return from KVM_GET_CLOCK".

 arch/x86/kvm/x86.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcelo Tosatti - 2009-11-03 13:15:58
On Tue, Nov 03, 2009 at 12:49:05PM +0100, Jan Kiszka wrote:
> The flags field of kvm_clock_data is supposed to indicate the
> availability of additional fields one day. There are none yet, so clear
> it. Moreover, drop the bogus check of this field and return 0 on
> success.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Note: This replaces "Clear flags field on return from KVM_GET_CLOCK".
> 
>  arch/x86/kvm/x86.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)

Applied, thanks.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1f68798..7344405 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2577,14 +2577,12 @@  long kvm_arch_vm_ioctl(struct file *filp,
 		ktime_get_ts(&now);
 		now_ns = timespec_to_ns(&now);
 		user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
+		user_ns.flags = 0;
 
+		r = -EFAULT;
 		if (copy_to_user(argp, &user_ns, sizeof(user_ns)))
-			r =  -EFAULT;
-
-		r = -EINVAL;
-		if (user_ns.flags)
 			goto out;
-
+		r = 0;
 		break;
 	}