Module Name:    src
Committed By:   christos
Date:           Fri Mar  4 01:36:56 UTC 2011

Modified Files:
        src/sys/compat/common: kern_time_50.c

Log Message:
PR/44674: Taylor R Campbell: Fix compat copyin and copyout routines which
were obviously broken.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.18 src/sys/compat/common/kern_time_50.c:1.19
--- src/sys/compat/common/kern_time_50.c:1.18	Wed Jan 19 05:21:16 2011
+++ src/sys/compat/common/kern_time_50.c	Thu Mar  3 20:36:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.18 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.18 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -453,8 +453,10 @@
 tscopyin(const void *u, void *s, size_t len)
 {
 	struct timespec50 ts50;
-	KASSERT(len == sizeof(ts50));
-	int error = copyin(u, &ts50, len);
+	int error;
+
+	KASSERT(len == sizeof(struct timespec));
+	error = copyin(u, &ts50, sizeof(ts50));
 	if (error)
 		return error;
 	timespec50_to_timespec(&ts50, s);
@@ -465,12 +467,10 @@
 tscopyout(const void *s, void *u, size_t len)
 {
 	struct timespec50 ts50;
-	KASSERT(len == sizeof(ts50));
+
+	KASSERT(len == sizeof(struct timespec));
 	timespec_to_timespec50(s, &ts50);
-	int error = copyout(&ts50, u, len);
-	if (error)
-		return error;
-	return 0;
+	return copyout(&ts50, u, sizeof(ts50));
 }
 
 int

Reply via email to