patch-2.3.29 linux/arch/arm/kernel/sys_arm.c

Next file: linux/arch/arm/lib/backtrace.S
Previous file: linux/arch/arm/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
@@ -119,104 +119,73 @@
 {
 	int version, ret;
 
-	lock_kernel();
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
-	if (call <= SEMCTL)
-		switch (call) {
-		case SEMOP:
-			ret = sys_semop (first, (struct sembuf *)ptr, second);
-			goto out;
-		case SEMGET:
-			ret = sys_semget (first, second, third);
-			goto out;
-		case SEMCTL: {
-			union semun fourth;
-			ret = -EINVAL;
+	switch (call) {
+	case SEMOP:
+		return sys_semop (first, (struct sembuf *)ptr, second);
+	case SEMGET:
+		return sys_semget (first, second, third);
+	case SEMCTL: {
+		union semun fourth;
+		if (!ptr)
+			return -EINVAL;
+		if (get_user(fourth.__pad, (void **) ptr))
+			return -EFAULT;
+		return sys_semctl (first, second, third, fourth);
+	}
+
+	case MSGSND:
+		return sys_msgsnd (first, (struct msgbuf *) ptr, 
+				   second, third);
+	case MSGRCV:
+		switch (version) {
+		case 0: {
+			struct ipc_kludge tmp;
 			if (!ptr)
-				goto out;
-			ret = -EFAULT;
-			if (get_user(fourth.__pad, (void **) ptr))
-				goto out;
-			ret = sys_semctl (first, second, third, fourth);
-			goto out;
-			}
-		default:
-			ret = -EINVAL;
-			goto out;
+				return -EINVAL;
+			if (copy_from_user(&tmp,(struct ipc_kludge *) ptr,
+					   sizeof (tmp)))
+				return -EFAULT;
+			return sys_msgrcv (first, tmp.msgp, second,
+					   tmp.msgtyp, third);
 		}
-	if (call <= MSGCTL) 
-		switch (call) {
-		case MSGSND:
-			ret = sys_msgsnd (first, (struct msgbuf *) ptr, 
-					  second, third);
-			goto out;
-		case MSGRCV:
-			switch (version) {
-			case 0: {
-				struct ipc_kludge tmp;
-				ret = -EINVAL;
-				if (!ptr)
-					goto out;
-				ret = -EFAULT;
-				if (copy_from_user(&tmp,(struct ipc_kludge *) ptr,
-						   sizeof (tmp)))
-					goto out;
-				ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
-				goto out;
-				}
-			case 1: default:
-				ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
-				goto out;
-			}
-		case MSGGET:
-			ret = sys_msgget ((key_t) first, second);
-			goto out;
-		case MSGCTL:
-			ret = sys_msgctl (first, second, (struct msqid_ds *) ptr);
-			goto out;
 		default:
-			ret = -EINVAL;
-			goto out;
+			return sys_msgrcv (first,
+					   (struct msgbuf *) ptr,
+					   second, fifth, third);
 		}
-	if (call <= SHMCTL) 
-		switch (call) {
-		case SHMAT:
-			switch (version) {
-			case 0: default: {
-				ulong raddr;
-				ret = sys_shmat (first, (char *) ptr, second, &raddr);
-				if (ret)
-					goto out;
-				ret = put_user (raddr, (ulong *) third);
-				goto out;
-				}
-			case 1:	/* iBCS2 emulator entry point */
-				ret = -EINVAL;
-				if (!segment_eq(get_fs(), get_ds()))
-					goto out;
-				ret = sys_shmat (first, (char *) ptr, second, (ulong *) third);
-				goto out;
-			}
-		case SHMDT: 
-			ret = sys_shmdt ((char *)ptr);
-			goto out;
-		case SHMGET:
-			ret = sys_shmget (first, second, third);
-			goto out;
-		case SHMCTL:
-			ret = sys_shmctl (first, second, (struct shmid_ds *) ptr);
-			goto out;
-		default:
-			ret = -EINVAL;
-			goto out;
+	case MSGGET:
+		return sys_msgget ((key_t) first, second);
+	case MSGCTL:
+		return sys_msgctl (first, second, (struct msqid_ds *) ptr);
+
+	case SHMAT:
+		switch (version) {
+		default: {
+			ulong raddr;
+			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			if (ret)
+				return ret;
+			return put_user (raddr, (ulong *) third);
+		}
+		case 1:	/* iBCS2 emulator entry point */
+			if (!segment_eq(get_fs(), get_ds()))
+				return -EINVAL;
+			return sys_shmat (first, (char *) ptr,
+					  second, (ulong *) third);
 		}
-	else
-		ret = -EINVAL;
-out:
-	unlock_kernel();
-	return ret;
+	case SHMDT: 
+		return sys_shmdt ((char *)ptr);
+	case SHMGET:
+		return sys_shmget (first, second, third);
+	case SHMCTL:
+		return sys_shmctl (first, second,
+				   (struct shmid_ds *) ptr);
+	default:
+		return -EINVAL;
+	}
 }
 
 /* Fork a new task - this creates a new program thread.

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)