[PATCH 2/2] vfs: Get rid of duplicate file_ops check in do_readv_writev()

From: Namhyung Kim
Date: Sun Sep 29 2013 - 05:38:35 EST


The file->f_op check in do_readv_writev() is redundant since all of
its caller (vfs_readv and vfs_writev) already did the check. The
same goes to compat_do_readv_writev().

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
fs/read_write.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 878f40e50451..a8bcdd26b16e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -721,11 +721,6 @@ static ssize_t do_readv_writev(int type, struct file *file,
io_fn_t fn;
iov_fn_t fnv;

- if (!file->f_op) {
- ret = -EINVAL;
- goto out;
- }
-
ret = rw_copy_check_uvector(type, uvector, nr_segs,
ARRAY_SIZE(iovstack), iovstack, &iov);
if (ret <= 0)
@@ -894,10 +889,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
io_fn_t fn;
iov_fn_t fnv;

- ret = -EINVAL;
- if (!file->f_op)
- goto out;
-
ret = -EFAULT;
if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
goto out;
--
1.7.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/