aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/sys_parisc32.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index ce3245f87fdd..a8ebac4fadec 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -350,6 +350,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
350 struct getdents32_callback buf; 350 struct getdents32_callback buf;
351 int error; 351 int error;
352 352
353 error = -EFAULT;
354 if (!access_ok(VERIFY_WRITE, dirent, count))
355 goto out;
356
353 error = -EBADF; 357 error = -EBADF;
354 file = fget(fd); 358 file = fget(fd);
355 if (!file) 359 if (!file)
@@ -366,8 +370,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
366 error = buf.error; 370 error = buf.error;
367 lastdirent = buf.previous; 371 lastdirent = buf.previous;
368 if (lastdirent) { 372 if (lastdirent) {
369 put_user(file->f_pos, &lastdirent->d_off); 373 if (put_user(file->f_pos, &lastdirent->d_off))
370 error = count - buf.count; 374 error = -EFAULT;
375 else
376 error = count - buf.count;
371 } 377 }
372 378
373out_putf: 379out_putf: