Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1fd1f49 authored by Al Viro's avatar Al Viro
Browse files

get rid of union semop in sys_semctl(2) arguments



just have the bugger take unsigned long and deal with SETVAL
case (when we use an int member in the union) explicitly.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4b377bab
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -60,21 +60,6 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
    return -ENOSYS;
}

asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
{
        union semun u;
	
        if (cmd == SETVAL) {
                /* Ugh.  arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
                 * The int should be in the first 4, but our argument
                 * frobbing has left it in the last 4.
                 */
                u.val = *((int *)&arg + 1);
                return sys_semctl (semid, semnum, cmd, u);
	}
	return sys_semctl (semid, semnum, cmd, arg);
}

asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
					 u32 mask_lo, int fd,
					 const char __user *pathname)
+1 −1
Original line number Diff line number Diff line
@@ -282,7 +282,7 @@
	ENTRY_COMP(recvmsg)
	ENTRY_SAME(semop)		/* 185 */
	ENTRY_SAME(semget)
	ENTRY_DIFF(semctl)
	ENTRY_COMP(semctl)
	ENTRY_COMP(msgsnd)
	ENTRY_COMP(msgrcv)
	ENTRY_SAME(msgget)		/* 190 */
+1 −1
Original line number Diff line number Diff line
@@ -353,7 +353,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
		case SEMCTL: {
			err = sys_semctl(first, second,
					 (int)third | IPC_64,
					 (union semun) ptr);
					 (unsigned long) ptr);
			goto out;
		}
		default:
+1 −1
Original line number Diff line number Diff line
@@ -657,7 +657,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
asmlinkage long sys_semget(key_t key, int nsems, int semflg);
asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
				unsigned nsops);
asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg);
asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
				unsigned nsops,
				const struct timespec __user *timeout);
+9 −5
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ static inline int put_compat_semid_ds(struct semid64_ds *s,

static long do_compat_semctl(int first, int second, int third, u32 pad)
{
	union semun fourth;
	unsigned long fourth;
	int err, err2;
	struct semid64_ds s64;
	struct semid64_ds __user *up64;
@@ -249,9 +249,13 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
	memset(&s64, 0, sizeof(s64));

	if ((third & (~IPC_64)) == SETVAL)
		fourth.val = (int) pad;
#ifdef __BIG_ENDIAN
		fourth = (unsigned long)pad << 32;
#else
		fourth = pad;
#endif
	else
		fourth.__pad = compat_ptr(pad);
		fourth = (unsigned long)compat_ptr(pad);
	switch (third & (~IPC_64)) {
	case IPC_INFO:
	case IPC_RMID:
@@ -269,7 +273,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
	case IPC_STAT:
	case SEM_STAT:
		up64 = compat_alloc_user_space(sizeof(s64));
		fourth.__pad = up64;
		fourth = (unsigned long)up64;
		err = sys_semctl(first, second, third, fourth);
		if (err < 0)
			break;
@@ -295,7 +299,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
		if (err)
			break;

		fourth.__pad = up64;
		fourth = (unsigned long)up64;
		err = sys_semctl(first, second, third, fourth);
		break;

Loading