patch-2.1.11 linux/kernel/itimer.c

Next file: linux/kernel/module.c
Previous file: linux/kernel/info.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.10/linux/kernel/itimer.c linux/kernel/itimer.c
@@ -88,11 +88,7 @@
 	error = _getitimer(which, &get_buffer);
 	if (error)
 		return error;
-	error = verify_area(VERIFY_WRITE, value, sizeof(struct itimerval));
-	if (error)
-		return error;
-	copy_to_user(value, &get_buffer, sizeof(get_buffer));
-	return 0;
+	return copy_to_user(value, &get_buffer, sizeof(get_buffer)) ? -EFAULT : 0;
 }
 
 void it_real_fn(unsigned long __data)
@@ -162,20 +158,17 @@
 		error = verify_area(VERIFY_READ, value, sizeof(*value));
 		if (error)
 			return error;
-		copy_from_user(&set_buffer, value, sizeof(set_buffer));
+		error = copy_from_user(&set_buffer, value, sizeof(set_buffer));
+		if (error)
+			return -EFAULT;
 	} else
 		memset((char *) &set_buffer, 0, sizeof(set_buffer));
 
-	if (ovalue) {
-		error = verify_area(VERIFY_WRITE, ovalue, sizeof(struct itimerval));
-		if (error)
-			return error;
-	}
-
 	error = _setitimer(which, &set_buffer, ovalue ? &get_buffer : 0);
 	if (error || !ovalue)
 		return error;
 
-	copy_to_user(ovalue, &get_buffer, sizeof(get_buffer));
+	if (copy_to_user(ovalue, &get_buffer, sizeof(get_buffer)))
+		error = -EFAULT; 
 	return error;
 }

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