Commit da220b09 authored by Linus Torvalds's avatar Linus Torvalds

Add user pointer attributes to kernel/sys.c

parent d97a291a
...@@ -377,7 +377,7 @@ asmlinkage long sys_getpriority(int which, int who) ...@@ -377,7 +377,7 @@ asmlinkage long sys_getpriority(int which, int who)
* *
* reboot doesn't sync: do that yourself before calling this. * reboot doesn't sync: do that yourself before calling this.
*/ */
asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg) asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg)
{ {
char buffer[256]; char buffer[256];
...@@ -430,7 +430,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg) ...@@ -430,7 +430,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
break; break;
case LINUX_REBOOT_CMD_RESTART2: case LINUX_REBOOT_CMD_RESTART2:
if (strncpy_from_user(&buffer[0], (char *)arg, sizeof(buffer) - 1) < 0) { if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {
unlock_kernel(); unlock_kernel();
return -EFAULT; return -EFAULT;
} }
...@@ -877,7 +877,7 @@ asmlinkage long sys_setfsgid(gid_t gid) ...@@ -877,7 +877,7 @@ asmlinkage long sys_setfsgid(gid_t gid)
return old_fsgid; return old_fsgid;
} }
asmlinkage long sys_times(struct tms * tbuf) asmlinkage long sys_times(struct tms __user * tbuf)
{ {
/* /*
* In the SMP world we might just be unlucky and have one of * In the SMP world we might just be unlucky and have one of
...@@ -1058,7 +1058,7 @@ asmlinkage long sys_setsid(void) ...@@ -1058,7 +1058,7 @@ asmlinkage long sys_setsid(void)
/* /*
* Supplementary group IDs * Supplementary group IDs
*/ */
asmlinkage long sys_getgroups(int gidsetsize, gid_t *grouplist) asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)
{ {
int i; int i;
...@@ -1084,7 +1084,7 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t *grouplist) ...@@ -1084,7 +1084,7 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t *grouplist)
* without another task interfering. * without another task interfering.
*/ */
asmlinkage long sys_setgroups(int gidsetsize, gid_t *grouplist) asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist)
{ {
gid_t groups[NGROUPS]; gid_t groups[NGROUPS];
int retval; int retval;
...@@ -1093,7 +1093,7 @@ asmlinkage long sys_setgroups(int gidsetsize, gid_t *grouplist) ...@@ -1093,7 +1093,7 @@ asmlinkage long sys_setgroups(int gidsetsize, gid_t *grouplist)
return -EPERM; return -EPERM;
if ((unsigned) gidsetsize > NGROUPS) if ((unsigned) gidsetsize > NGROUPS)
return -EINVAL; return -EINVAL;
if(copy_from_user(groups, grouplist, gidsetsize * sizeof(gid_t))) if (copy_from_user(groups, grouplist, gidsetsize * sizeof(gid_t)))
return -EFAULT; return -EFAULT;
retval = security_task_setgroups(gidsetsize, groups); retval = security_task_setgroups(gidsetsize, groups);
if (retval) if (retval)
...@@ -1140,7 +1140,7 @@ int in_egroup_p(gid_t grp) ...@@ -1140,7 +1140,7 @@ int in_egroup_p(gid_t grp)
DECLARE_RWSEM(uts_sem); DECLARE_RWSEM(uts_sem);
asmlinkage long sys_newuname(struct new_utsname * name) asmlinkage long sys_newuname(struct new_utsname __user * name)
{ {
int errno = 0; int errno = 0;
...@@ -1151,7 +1151,7 @@ asmlinkage long sys_newuname(struct new_utsname * name) ...@@ -1151,7 +1151,7 @@ asmlinkage long sys_newuname(struct new_utsname * name)
return errno; return errno;
} }
asmlinkage long sys_sethostname(char *name, int len) asmlinkage long sys_sethostname(char __user *name, int len)
{ {
int errno; int errno;
...@@ -1169,7 +1169,7 @@ asmlinkage long sys_sethostname(char *name, int len) ...@@ -1169,7 +1169,7 @@ asmlinkage long sys_sethostname(char *name, int len)
return errno; return errno;
} }
asmlinkage long sys_gethostname(char *name, int len) asmlinkage long sys_gethostname(char __user *name, int len)
{ {
int i, errno; int i, errno;
...@@ -1190,7 +1190,7 @@ asmlinkage long sys_gethostname(char *name, int len) ...@@ -1190,7 +1190,7 @@ asmlinkage long sys_gethostname(char *name, int len)
* Only setdomainname; getdomainname can be implemented by calling * Only setdomainname; getdomainname can be implemented by calling
* uname() * uname()
*/ */
asmlinkage long sys_setdomainname(char *name, int len) asmlinkage long sys_setdomainname(char __user *name, int len)
{ {
int errno; int errno;
...@@ -1209,7 +1209,7 @@ asmlinkage long sys_setdomainname(char *name, int len) ...@@ -1209,7 +1209,7 @@ asmlinkage long sys_setdomainname(char *name, int len)
return errno; return errno;
} }
asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim) asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
{ {
if (resource >= RLIM_NLIMITS) if (resource >= RLIM_NLIMITS)
return -EINVAL; return -EINVAL;
...@@ -1224,7 +1224,7 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim) ...@@ -1224,7 +1224,7 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim)
* Back compatibility for getrlimit. Needed for some apps. * Back compatibility for getrlimit. Needed for some apps.
*/ */
asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit *rlim) asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit x; struct rlimit x;
if (resource >= RLIM_NLIMITS) if (resource >= RLIM_NLIMITS)
...@@ -1240,7 +1240,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit *rlim) ...@@ -1240,7 +1240,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit *rlim)
#endif #endif
asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim) asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit new_rlim, *old_rlim; struct rlimit new_rlim, *old_rlim;
int retval; int retval;
...@@ -1286,7 +1286,7 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim) ...@@ -1286,7 +1286,7 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim)
* *
* FIXME! Get the fault counts properly! * FIXME! Get the fault counts properly!
*/ */
int getrusage(struct task_struct *p, int who, struct rusage *ru) int getrusage(struct task_struct *p, int who, struct rusage __user *ru)
{ {
struct rusage r; struct rusage r;
...@@ -1317,7 +1317,7 @@ int getrusage(struct task_struct *p, int who, struct rusage *ru) ...@@ -1317,7 +1317,7 @@ int getrusage(struct task_struct *p, int who, struct rusage *ru)
return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
} }
asmlinkage long sys_getrusage(int who, struct rusage *ru) asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
{ {
if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN) if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
return -EINVAL; return -EINVAL;
...@@ -1350,7 +1350,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, ...@@ -1350,7 +1350,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
current->pdeath_signal = sig; current->pdeath_signal = sig;
break; break;
case PR_GET_PDEATHSIG: case PR_GET_PDEATHSIG:
error = put_user(current->pdeath_signal, (int *)arg2); error = put_user(current->pdeath_signal, (int __user *)arg2);
break; break;
case PR_GET_DUMPABLE: case PR_GET_DUMPABLE:
if (current->mm->dumpable) if (current->mm->dumpable)
......
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