From: Al Viro Date: Wed, 19 Feb 2020 03:34:07 +0000 (-0500) Subject: readdir.c: get rid of the last __put_user(), drop now-useless access_ok() X-Git-Tag: v5.8-rc1~208^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fb1514164de20ddb21886ffceda4cb54d6538f6;p=thirdparty%2Fkernel%2Flinux.git readdir.c: get rid of the last __put_user(), drop now-useless access_ok() Signed-off-by: Al Viro --- diff --git a/fs/readdir.c b/fs/readdir.c index 9534675880cee..a49f07c11cfbd 100644 --- a/fs/readdir.c +++ b/fs/readdir.c @@ -276,9 +276,6 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, }; int error; - if (!access_ok(dirent, count)) - return -EFAULT; - f = fdget_pos(fd); if (!f.file) return -EBADF; @@ -362,9 +359,6 @@ int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent, }; int error; - if (!access_ok(dirent, count)) - return -EFAULT; - f = fdget_pos(fd); if (!f.file) return -EBADF; @@ -377,7 +371,7 @@ int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent, typeof(lastdirent->d_off) d_off = buf.ctx.pos; lastdirent = (void __user *) buf.current_dir - buf.prev_reclen; - if (__put_user(d_off, &lastdirent->d_off)) + if (put_user(d_off, &lastdirent->d_off)) error = -EFAULT; else error = count - buf.count; @@ -537,9 +531,6 @@ COMPAT_SYSCALL_DEFINE3(getdents, unsigned int, fd, }; int error; - if (!access_ok(dirent, count)) - return -EFAULT; - f = fdget_pos(fd); if (!f.file) return -EBADF;