From: Namhyung Kim <namhyung@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] vfs: Get rid of duplicate offset checks in p{read,write}*
Date: Sun, 29 Sep 2013 18:37:49 +0900 [thread overview]
Message-ID: <1380447470-2811-1-git-send-email-namhyung@kernel.org> (raw)
Current pread/pwrite functions simply checks whether offset is
negative. Thus we couldn't use these functions for the large
(negative) offsets although some files did allow that.
Checking it correctly requires a file pointer and we already did
the check in rw_verify_area() so just remove the checks.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
fs/read_write.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index e3cd280b158c..878f40e50451 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -534,9 +534,6 @@ SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
struct fd f;
ssize_t ret = -EBADF;
- if (pos < 0)
- return -EINVAL;
-
f = fdget(fd);
if (f.file) {
ret = -ESPIPE;
@@ -554,9 +551,6 @@ SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
struct fd f;
ssize_t ret = -EBADF;
- if (pos < 0)
- return -EINVAL;
-
f = fdget(fd);
if (f.file) {
ret = -ESPIPE;
@@ -852,9 +846,6 @@ SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
struct fd f;
ssize_t ret = -EBADF;
- if (pos < 0)
- return -EINVAL;
-
f = fdget(fd);
if (f.file) {
ret = -ESPIPE;
@@ -876,9 +867,6 @@ SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
struct fd f;
ssize_t ret = -EBADF;
- if (pos < 0)
- return -EINVAL;
-
f = fdget(fd);
if (f.file) {
ret = -ESPIPE;
@@ -1002,8 +990,6 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
struct fd f;
ssize_t ret;
- if (pos < 0)
- return -EINVAL;
f = fdget(fd);
if (!f.file)
return -EBADF;
@@ -1069,8 +1055,6 @@ COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
struct fd f;
ssize_t ret;
- if (pos < 0)
- return -EINVAL;
f = fdget(fd);
if (!f.file)
return -EBADF;
--
1.7.9.2
next reply other threads:[~2013-09-29 9:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-29 9:37 Namhyung Kim [this message]
2013-09-29 9:37 ` [PATCH 2/2] vfs: Get rid of duplicate file_ops check in do_readv_writev() Namhyung Kim
2013-09-29 22:24 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380447470-2811-1-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox