linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/5] splice: Get rid of duplicate f_mode checks
Date: Sun, 29 Sep 2013 15:14:34 +0900	[thread overview]
Message-ID: <1380435278-10927-1-git-send-email-namhyung@kernel.org> (raw)

The do_splice() function was only called from sys_splice() but it
already checks the f_mode both for in and out.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 fs/splice.c |    9 ---------
 1 file changed, 9 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 3b7ee656f3aa..320cc65585b2 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1333,12 +1333,6 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 		if (off_in || off_out)
 			return -ESPIPE;
 
-		if (!(in->f_mode & FMODE_READ))
-			return -EBADF;
-
-		if (!(out->f_mode & FMODE_WRITE))
-			return -EBADF;
-
 		/* Splicing to self would be fun, but... */
 		if (ipipe == opipe)
 			return -EINVAL;
@@ -1358,9 +1352,6 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 			offset = out->f_pos;
 		}
 
-		if (unlikely(!(out->f_mode & FMODE_WRITE)))
-			return -EBADF;
-
 		if (unlikely(out->f_flags & O_APPEND))
 			return -EINVAL;
 
-- 
1.7.9.2


             reply	other threads:[~2013-09-29  6:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-29  6:14 Namhyung Kim [this message]
2013-09-29  6:14 ` [PATCH 2/5] splice: Add sync parameter to wakeup_pipe_readers() Namhyung Kim
2013-09-29  6:14 ` [PATCH 3/5] splice: Add sync parameter to wakeup_pipe_writers() Namhyung Kim
2013-09-29  6:14 ` [PATCH 4/5] splice: Use sync wakeup for splice_from_pipe_next() Namhyung Kim
2013-09-29  6:14 ` [PATCH 5/5] pipe: Do not use sync wakeups Namhyung Kim

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=1380435278-10927-1-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=axboe@kernel.dk \
    --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;
as well as URLs for NNTP newsgroup(s).