patch-2.1.11 linux/kernel/time.c

Next file: linux/mm/swapfile.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.10/linux/kernel/time.c linux/kernel/time.c
@@ -202,15 +202,13 @@
 	/* Local copy of parameter */
 	struct timex txc;
 
-	error = verify_area(VERIFY_WRITE, txc_p, sizeof(struct timex));
-	if (error)
-	  return error;
-
 	/* Copy the user data space into the kernel copy
 	 * structure. But bear in mind that the structures
 	 * may change
 	 */
-	copy_from_user(&txc, txc_p, sizeof(struct timex));
+	error = copy_from_user(&txc, txc_p, sizeof(struct timex));
+	if (error)
+		return -EFAULT;	
 
 	/* In order to modify anything, you gotta be super-user! */
 	if (txc.modes && !suser())
@@ -345,6 +343,5 @@
 
 	sti();
 
-	copy_to_user(txc_p, &txc, sizeof(struct timex));
-	return time_state;
+	return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : time_state;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov