aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/linux32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r--arch/mips/kernel/linux32.c64
1 files changed, 2 insertions, 62 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 7c953bcc5f6a..a7d2bb3cf835 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -356,73 +356,13 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
356asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, 356asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,
357 size_t count, u32 unused, u64 a4, u64 a5) 357 size_t count, u32 unused, u64 a4, u64 a5)
358{ 358{
359 ssize_t ret; 359 return sys_pread64(fd, buf, count, merge_64(a4, a5));
360 struct file * file;
361 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
362 loff_t pos;
363
364 ret = -EBADF;
365 file = fget(fd);
366 if (!file)
367 goto bad_file;
368 if (!(file->f_mode & FMODE_READ))
369 goto out;
370 pos = merge_64(a4, a5);
371 ret = rw_verify_area(READ, file, &pos, count);
372 if (ret < 0)
373 goto out;
374 ret = -EINVAL;
375 if (!file->f_op || !(read = file->f_op->read))
376 goto out;
377 if (pos < 0)
378 goto out;
379 ret = -ESPIPE;
380 if (!(file->f_mode & FMODE_PREAD))
381 goto out;
382 ret = read(file, buf, count, &pos);
383 if (ret > 0)
384 dnotify_parent(file->f_dentry, DN_ACCESS);
385out:
386 fput(file);
387bad_file:
388 return ret;
389} 360}
390 361
391asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, 362asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,
392 size_t count, u32 unused, u64 a4, u64 a5) 363 size_t count, u32 unused, u64 a4, u64 a5)
393{ 364{
394 ssize_t ret; 365 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
395 struct file * file;
396 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
397 loff_t pos;
398
399 ret = -EBADF;
400 file = fget(fd);
401 if (!file)
402 goto bad_file;
403 if (!(file->f_mode & FMODE_WRITE))
404 goto out;
405 pos = merge_64(a4, a5);
406 ret = rw_verify_area(WRITE, file, &pos, count);
407 if (ret < 0)
408 goto out;
409 ret = -EINVAL;
410 if (!file->f_op || !(write = file->f_op->write))
411 goto out;
412 if (pos < 0)
413 goto out;
414
415 ret = -ESPIPE;
416 if (!(file->f_mode & FMODE_PWRITE))
417 goto out;
418
419 ret = write(file, buf, count, &pos);
420 if (ret > 0)
421 dnotify_parent(file->f_dentry, DN_MODIFY);
422out:
423 fput(file);
424bad_file:
425 return ret;
426} 366}
427 367
428asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, 368asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,