patch-2.1.36 linux/arch/m68k/kernel/sys_m68k.c

Next file: linux/arch/m68k/kernel/traps.c
Previous file: linux/arch/m68k/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/arch/m68k/kernel/sys_m68k.c linux/arch/m68k/kernel/sys_m68k.c
@@ -34,15 +34,11 @@
 	int error;
 
 	lock_kernel();
-	error = verify_area(VERIFY_WRITE,fildes,8);
-	if (error)
-		goto out;
 	error = do_pipe(fd);
-	if (error)
-		goto out;
-	put_user(fd[0],0+fildes);
-	put_user(fd[1],1+fildes);
-out:
+	if (!error) {
+		if (copy_to_user(fildes, fd, 2*sizeof(int)))
+			error = -EFAULT;
+	}
 	unlock_kernel();
 	return error;
 }
@@ -70,10 +66,10 @@
 	struct mmap_arg_struct a;
 
 	lock_kernel();
-	error = verify_area(VERIFY_READ, arg, sizeof(*arg));
-	if (error)
+	error = -EFAULT;
+	if (copy_from_user(&a, arg, sizeof(a)))
 		goto out;
-	copy_from_user(&a, arg, sizeof(a));
+
 	if (!(a.flags & MAP_ANONYMOUS)) {
 		error = -EBADF;
 		if (a.fd >= NR_OPEN || !(file = current->files->fd[a.fd]))
@@ -98,15 +94,11 @@
 asmlinkage int old_select(struct sel_arg_struct *arg)
 {
 	struct sel_arg_struct a;
-	int ret = -EFAULT;
 
-	lock_kernel();
 	if (copy_from_user(&a, arg, sizeof(a)))
-		goto out;
-	ret = sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-out:
-	unlock_kernel();
-	return ret;
+		return -EFAULT;
+       /* sys_select() does the appropriate kernel locking */
+	return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
 }
 
 /*
@@ -134,9 +126,8 @@
 			ret = -EINVAL;
 			if (!ptr)
 				goto out;
-			if ((ret = verify_area (VERIFY_READ, ptr, sizeof(long))))
+			if ((ret = get_user(fourth.__pad, (void **) ptr)))
 				goto out;
-			get_user(fourth.__pad, (void **)ptr);
 			ret = sys_semctl (first, second, third, fourth);
 			goto out;
 			}
@@ -183,22 +174,13 @@
 			switch (version) {
 			case 0: default: {
 				ulong raddr;
-				if ((ret = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
-					goto out;
 				ret = sys_shmat (first, (char *) ptr, second, &raddr);
 				if (ret)
 					goto out;
-				put_user (raddr, (ulong *) third);
-				ret = 0;
-				goto out;
-				}
-			case 1:	/* iBCS2 emulator entry point */
-				ret = -EINVAL;
-				if (get_fs() != get_ds())
-					goto out;
-				ret = sys_shmat (first, (char *) ptr, second, (ulong *) third);
+				ret = put_user (raddr, (ulong *) third);
 				goto out;
 			}
+			}
 		case SHMDT: 
 			ret = sys_shmdt ((char *)ptr);
 			goto out;
@@ -212,8 +194,7 @@
 			ret = -EINVAL;
 			goto out;
 		}
-	else
-		ret = -EINVAL;
+	ret = -EINVAL;
 out:
 	unlock_kernel();
 	return ret;

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