Commit be6e518b authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] Sparse: Add __user tags to syscall.c

Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>

---
parent 72bf8914
...@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) ...@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
int error; int error;
char * filename; char * filename;
filename = getname((char *) (long)regs.regs[4]); filename = getname((char __user *) (long)regs.regs[4]);
error = PTR_ERR(filename); error = PTR_ERR(filename);
if (IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
error = do_execve(filename, (char **) (long)regs.regs[5], error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
(char **) (long)regs.regs[6], &regs); (char __user *__user *) (long)regs.regs[6], &regs);
putname(filename); putname(filename);
out: out:
...@@ -227,7 +227,7 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) ...@@ -227,7 +227,7 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
/* /*
* Compacrapability ... * Compacrapability ...
*/ */
asmlinkage int sys_uname(struct old_utsname * name) asmlinkage int sys_uname(struct old_utsname __user * name)
{ {
if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
return 0; return 0;
...@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name) ...@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
/* /*
* Compacrapability ... * Compacrapability ...
*/ */
asmlinkage int sys_olduname(struct oldold_utsname * name) asmlinkage int sys_olduname(struct oldold_utsname __user * name)
{ {
int error; int error;
...@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr) ...@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr)
asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
{ {
int tmp, len; int tmp, len;
char *name; char __user *name;
switch(cmd) { switch(cmd) {
case SETNAME: { case SETNAME: {
...@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) ...@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
name = (char *) arg1; name = (char __user *) arg1;
len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
if (len < 0) if (len < 0)
...@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) ...@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
* 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,
unsigned long third, void *ptr, long fifth) unsigned long third, void __user *ptr, long fifth)
{ {
int version, ret; int version, ret;
...@@ -333,10 +333,11 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -333,10 +333,11 @@ asmlinkage int sys_ipc (uint call, int first, int second,
switch (call) { switch (call) {
case SEMOP: case SEMOP:
return sys_semtimedop (first, (struct sembuf *)ptr, second, return sys_semtimedop (first, (struct sembuf __user *)ptr,
NULL); second, NULL);
case SEMTIMEDOP: case SEMTIMEDOP:
return sys_semtimedop (first, (struct sembuf *)ptr, second, return sys_semtimedop (first, (struct sembuf __user *)ptr,
second,
(const struct timespec __user *)fifth); (const struct timespec __user *)fifth);
case SEMGET: case SEMGET:
return sys_semget (first, second, third); return sys_semget (first, second, third);
...@@ -344,13 +345,13 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -344,13 +345,13 @@ asmlinkage int sys_ipc (uint call, int first, int second,
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 *) ptr))
return -EFAULT; return -EFAULT;
return sys_semctl (first, second, third, fourth); return sys_semctl (first, second, third, fourth);
} }
case MSGSND: case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr, return sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third); second, third);
case MSGRCV: case MSGRCV:
switch (version) { switch (version) {
...@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
return -EINVAL; return -EINVAL;
if (copy_from_user(&tmp, if (copy_from_user(&tmp,
(struct ipc_kludge *) ptr, (struct ipc_kludge __user *) ptr,
sizeof (tmp))) sizeof (tmp)))
return -EFAULT; return -EFAULT;
return sys_msgrcv (first, tmp.msgp, second, return sys_msgrcv (first, tmp.msgp, second,
...@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second,
} }
default: default:
return sys_msgrcv (first, return sys_msgrcv (first,
(struct msgbuf *) ptr, (struct msgbuf __user *) 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, (struct msqid_ds *) ptr); return sys_msgctl (first, second,
(struct msqid_ds __user *) ptr);
case SHMAT: case SHMAT:
switch (version) { switch (version) {
default: { default: {
ulong raddr; ulong raddr;
ret = do_shmat (first, (char *) ptr, second, &raddr); ret = do_shmat (first, (char __user *) ptr, second,
&raddr);
if (ret) if (ret)
return ret; return ret;
return put_user (raddr, (ulong *) third); return put_user (raddr, (ulong __user *) third);
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
if (!segment_eq(get_fs(), get_ds())) if (!segment_eq(get_fs(), get_ds()))
return -EINVAL; return -EINVAL;
return do_shmat (first, (char *) ptr, second, (ulong *) third); return do_shmat (first, (char __user *) ptr, second,
(ulong *) third);
} }
case SHMDT: case SHMDT:
return sys_shmdt ((char *)ptr); return sys_shmdt ((char __user *)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,
(struct shmid_ds *) ptr); (struct shmid_ds __user *) ptr);
default: default:
return -ENOSYS; return -ENOSYS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment