Skip to content

Commit

Permalink
readdir.c: get rid of the last __put_user(), drop now-useless access_…
Browse files Browse the repository at this point in the history
…ok()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 2, 2020
1 parent 82af599 commit 5fb1514
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions fs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5fb1514

Please sign in to comment.