aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/linux32.c101
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/lasat/sysctl.c17
4 files changed, 12 insertions, 114 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 2fefb14414b7..aa2c55e3b55f 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -63,41 +63,6 @@
63#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL)) 63#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
64#endif 64#endif
65 65
66/*
67 * Revalidate the inode. This is required for proper NFS attribute caching.
68 */
69
70int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
71{
72 struct compat_stat tmp;
73
74 if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
75 return -EOVERFLOW;
76
77 memset(&tmp, 0, sizeof(tmp));
78 tmp.st_dev = new_encode_dev(stat->dev);
79 tmp.st_ino = stat->ino;
80 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)
81 return -EOVERFLOW;
82 tmp.st_mode = stat->mode;
83 tmp.st_nlink = stat->nlink;
84 SET_UID(tmp.st_uid, stat->uid);
85 SET_GID(tmp.st_gid, stat->gid);
86 tmp.st_rdev = new_encode_dev(stat->rdev);
87 tmp.st_size = stat->size;
88 tmp.st_atime = stat->atime.tv_sec;
89 tmp.st_mtime = stat->mtime.tv_sec;
90 tmp.st_ctime = stat->ctime.tv_sec;
91#ifdef STAT_HAVE_NSEC
92 tmp.st_atime_nsec = stat->atime.tv_nsec;
93 tmp.st_mtime_nsec = stat->mtime.tv_nsec;
94 tmp.st_ctime_nsec = stat->ctime.tv_nsec;
95#endif
96 tmp.st_blocks = stat->blocks;
97 tmp.st_blksize = stat->blksize;
98 return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
99}
100
101asmlinkage unsigned long 66asmlinkage unsigned long
102sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 67sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
103 unsigned long flags, unsigned long fd, unsigned long pgoff) 68 unsigned long flags, unsigned long fd, unsigned long pgoff)
@@ -168,72 +133,6 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
168 return sys_ftruncate(fd, merge_64(a2, a3)); 133 return sys_ftruncate(fd, merge_64(a2, a3));
169} 134}
170 135
171static inline long
172get_tv32(struct timeval *o, struct compat_timeval __user *i)
173{
174 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
175 (__get_user(o->tv_sec, &i->tv_sec) |
176 __get_user(o->tv_usec, &i->tv_usec)));
177}
178
179static inline long
180put_tv32(struct compat_timeval __user *o, struct timeval *i)
181{
182 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
183 (__put_user(i->tv_sec, &o->tv_sec) |
184 __put_user(i->tv_usec, &o->tv_usec)));
185}
186
187extern struct timezone sys_tz;
188
189asmlinkage int
190sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
191{
192 if (tv) {
193 struct timeval ktv;
194 do_gettimeofday(&ktv);
195 if (put_tv32(tv, &ktv))
196 return -EFAULT;
197 }
198 if (tz) {
199 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
200 return -EFAULT;
201 }
202 return 0;
203}
204
205static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
206{
207 long usec;
208
209 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
210 return -EFAULT;
211 if (__get_user(o->tv_sec, &i->tv_sec))
212 return -EFAULT;
213 if (__get_user(usec, &i->tv_usec))
214 return -EFAULT;
215 o->tv_nsec = usec * 1000;
216 return 0;
217}
218
219asmlinkage int
220sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
221{
222 struct timespec kts;
223 struct timezone ktz;
224
225 if (tv) {
226 if (get_ts32(&kts, tv))
227 return -EFAULT;
228 }
229 if (tz) {
230 if (copy_from_user(&ktz, tz, sizeof(ktz)))
231 return -EFAULT;
232 }
233
234 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
235}
236
237asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, 136asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
238 unsigned int offset_low, loff_t __user * result, 137 unsigned int offset_low, loff_t __user * result,
239 unsigned int origin) 138 unsigned int origin)
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 324c5499dec2..e266b3aa6560 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -214,7 +214,7 @@ EXPORT(sysn32_call_table)
214 PTR sys_fchown 214 PTR sys_fchown
215 PTR sys_lchown 215 PTR sys_lchown
216 PTR sys_umask 216 PTR sys_umask
217 PTR sys32_gettimeofday 217 PTR compat_sys_gettimeofday
218 PTR compat_sys_getrlimit /* 6095 */ 218 PTR compat_sys_getrlimit /* 6095 */
219 PTR compat_sys_getrusage 219 PTR compat_sys_getrusage
220 PTR compat_sys_sysinfo 220 PTR compat_sys_sysinfo
@@ -279,7 +279,7 @@ EXPORT(sysn32_call_table)
279 PTR sys_chroot 279 PTR sys_chroot
280 PTR sys_sync 280 PTR sys_sync
281 PTR sys_acct 281 PTR sys_acct
282 PTR sys32_settimeofday 282 PTR compat_sys_settimeofday
283 PTR compat_sys_mount /* 6160 */ 283 PTR compat_sys_mount /* 6160 */
284 PTR sys_umount 284 PTR sys_umount
285 PTR sys_swapon 285 PTR sys_swapon
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 85fedac99a57..6c7ef8313ebd 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -283,8 +283,8 @@ sys_call_table:
283 PTR compat_sys_setrlimit /* 4075 */ 283 PTR compat_sys_setrlimit /* 4075 */
284 PTR compat_sys_getrlimit 284 PTR compat_sys_getrlimit
285 PTR compat_sys_getrusage 285 PTR compat_sys_getrusage
286 PTR sys32_gettimeofday 286 PTR compat_sys_gettimeofday
287 PTR sys32_settimeofday 287 PTR compat_sys_settimeofday
288 PTR sys_getgroups /* 4080 */ 288 PTR sys_getgroups /* 4080 */
289 PTR sys_setgroups 289 PTR sys_setgroups
290 PTR sys_ni_syscall /* old_select */ 290 PTR sys_ni_syscall /* old_select */
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index 866881ec0cf8..8f88886feb12 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -38,14 +38,13 @@
38#endif 38#endif
39 39
40/* Strategy function to write EEPROM after changing string entry */ 40/* Strategy function to write EEPROM after changing string entry */
41int sysctl_lasatstring(ctl_table *table, int *name, int nlen, 41int sysctl_lasatstring(ctl_table *table,
42 void *oldval, size_t *oldlenp, 42 void *oldval, size_t *oldlenp,
43 void *newval, size_t newlen) 43 void *newval, size_t newlen)
44{ 44{
45 int r; 45 int r;
46 46
47 r = sysctl_string(table, name, 47 r = sysctl_string(table, oldval, oldlenp, newval, newlen);
48 nlen, oldval, oldlenp, newval, newlen);
49 if (r < 0) 48 if (r < 0)
50 return r; 49 return r;
51 50
@@ -113,13 +112,13 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
113#endif 112#endif
114 113
115/* Sysctl for setting the IP addresses */ 114/* Sysctl for setting the IP addresses */
116int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen, 115int sysctl_lasat_intvec(ctl_table *table,
117 void *oldval, size_t *oldlenp, 116 void *oldval, size_t *oldlenp,
118 void *newval, size_t newlen) 117 void *newval, size_t newlen)
119{ 118{
120 int r; 119 int r;
121 120
122 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen); 121 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
123 if (r < 0) 122 if (r < 0)
124 return r; 123 return r;
125 124
@@ -131,7 +130,7 @@ int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,
131 130
132#ifdef CONFIG_DS1603 131#ifdef CONFIG_DS1603
133/* Same for RTC */ 132/* Same for RTC */
134int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen, 133int sysctl_lasat_rtc(ctl_table *table,
135 void *oldval, size_t *oldlenp, 134 void *oldval, size_t *oldlenp,
136 void *newval, size_t newlen) 135 void *newval, size_t newlen)
137{ 136{
@@ -140,7 +139,7 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
140 rtctmp = read_persistent_clock(); 139 rtctmp = read_persistent_clock();
141 if (rtctmp < 0) 140 if (rtctmp < 0)
142 rtctmp = 0; 141 rtctmp = 0;
143 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen); 142 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
144 if (r < 0) 143 if (r < 0)
145 return r; 144 return r;
146 if (newval && newlen) 145 if (newval && newlen)
@@ -211,13 +210,13 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp,
211} 210}
212#endif 211#endif
213 212
214static int sysctl_lasat_prid(ctl_table *table, int *name, int nlen, 213static int sysctl_lasat_prid(ctl_table *table,
215 void *oldval, size_t *oldlenp, 214 void *oldval, size_t *oldlenp,
216 void *newval, size_t newlen) 215 void *newval, size_t newlen)
217{ 216{
218 int r; 217 int r;
219 218
220 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen); 219 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
221 if (r < 0) 220 if (r < 0)
222 return r; 221 return r;
223 if (newval && newlen) { 222 if (newval && newlen) {