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

Commit 350c20a6 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds
Browse files

[PATCH] m68k: syscalls __user annotation



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1b7bb54a
Loading
Loading
Loading
Loading
+16 −23
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@
 * sys_pipe() is the normal C calling standard for creating
 * sys_pipe() is the normal C calling standard for creating
 * a pipe. It's not the way unix traditionally does this, though.
 * a pipe. It's not the way unix traditionally does this, though.
 */
 */
asmlinkage int sys_pipe(unsigned long * fildes)
asmlinkage int sys_pipe(unsigned long __user * fildes)
{
{
	int fd[2];
	int fd[2];
	int error;
	int error;
@@ -94,7 +94,7 @@ struct mmap_arg_struct {
	unsigned long offset;
	unsigned long offset;
};
};


asmlinkage int old_mmap(struct mmap_arg_struct *arg)
asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
{
{
	struct mmap_arg_struct a;
	struct mmap_arg_struct a;
	int error = -EFAULT;
	int error = -EFAULT;
@@ -160,11 +160,11 @@ asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)


struct sel_arg_struct {
struct sel_arg_struct {
	unsigned long n;
	unsigned long n;
	fd_set *inp, *outp, *exp;
	fd_set __user *inp, *outp, *exp;
	struct timeval *tvp;
	struct timeval __user *tvp;
};
};


asmlinkage int old_select(struct sel_arg_struct *arg)
asmlinkage int old_select(struct sel_arg_struct __user *arg)
{
{
	struct sel_arg_struct a;
	struct sel_arg_struct a;


@@ -180,7 +180,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
 * This is really horribly ugly.
 * This is really horribly ugly.
 */
 */
asmlinkage int sys_ipc (uint call, int first, int second,
asmlinkage int sys_ipc (uint call, int first, int second,
			int third, void *ptr, long fifth)
			int third, void __user *ptr, long fifth)
{
{
	int version, ret;
	int version, ret;


@@ -190,14 +190,14 @@ asmlinkage int sys_ipc (uint call, int first, int second,
	if (call <= SEMCTL)
	if (call <= SEMCTL)
		switch (call) {
		switch (call) {
		case SEMOP:
		case SEMOP:
			return sys_semop (first, (struct sembuf *)ptr, second);
			return sys_semop (first, ptr, second);
		case SEMGET:
		case SEMGET:
			return sys_semget (first, second, third);
			return sys_semget (first, second, third);
		case SEMCTL: {
		case SEMCTL: {
			union semun fourth;
			union semun fourth;
			if (!ptr)
			if (!ptr)
				return -EINVAL;
				return -EINVAL;
			if (get_user(fourth.__pad, (void **) ptr))
			if (get_user(fourth.__pad, (void __user *__user *) ptr))
				return -EFAULT;
				return -EFAULT;
			return sys_semctl (first, second, third, fourth);
			return sys_semctl (first, second, third, fourth);
			}
			}
@@ -207,31 +207,26 @@ asmlinkage int sys_ipc (uint call, int first, int second,
	if (call <= MSGCTL)
	if (call <= MSGCTL)
		switch (call) {
		switch (call) {
		case MSGSND:
		case MSGSND:
			return sys_msgsnd (first, (struct msgbuf *) ptr,
			return sys_msgsnd (first, ptr, second, third);
					  second, third);
		case MSGRCV:
		case MSGRCV:
			switch (version) {
			switch (version) {
			case 0: {
			case 0: {
				struct ipc_kludge tmp;
				struct ipc_kludge tmp;
				if (!ptr)
				if (!ptr)
					return -EINVAL;
					return -EINVAL;
				if (copy_from_user (&tmp,
				if (copy_from_user (&tmp, ptr, sizeof (tmp)))
						    (struct ipc_kludge *)ptr,
						    sizeof (tmp)))
					return -EFAULT;
					return -EFAULT;
				return sys_msgrcv (first, tmp.msgp, second,
				return sys_msgrcv (first, tmp.msgp, second,
						   tmp.msgtyp, third);
						   tmp.msgtyp, third);
				}
				}
			default:
			default:
				return sys_msgrcv (first,
				return sys_msgrcv (first, ptr,
						   (struct msgbuf *) ptr,
						   second, fifth, third);
						   second, fifth, third);
			}
			}
		case MSGGET:
		case MSGGET:
			return sys_msgget ((key_t) first, second);
			return sys_msgget ((key_t) first, second);
		case MSGCTL:
		case MSGCTL:
			return sys_msgctl (first, second,
			return sys_msgctl (first, second, ptr);
					   (struct msqid_ds *) ptr);
		default:
		default:
			return -ENOSYS;
			return -ENOSYS;
		}
		}
@@ -241,20 +236,18 @@ asmlinkage int sys_ipc (uint call, int first, int second,
			switch (version) {
			switch (version) {
			default: {
			default: {
				ulong raddr;
				ulong raddr;
				ret = do_shmat (first, (char *) ptr,
				ret = do_shmat (first, ptr, second, &raddr);
						 second, &raddr);
				if (ret)
				if (ret)
					return ret;
					return ret;
				return put_user (raddr, (ulong *) third);
				return put_user (raddr, (ulong __user *) third);
			}
			}
			}
			}
		case SHMDT:
		case SHMDT:
			return sys_shmdt ((char *)ptr);
			return sys_shmdt (ptr);
		case SHMGET:
		case SHMGET:
			return sys_shmget (first, second, third);
			return sys_shmget (first, second, third);
		case SHMCTL:
		case SHMCTL:
			return sys_shmctl (first, second,
			return sys_shmctl (first, second, ptr);
					   (struct shmid_ds *) ptr);
		default:
		default:
			return -ENOSYS;
			return -ENOSYS;
		}
		}