From: akpm@linux-foundation.org Subject: [patch 13/21] vfs: remove redundant position check in do_sendfile Date: Fri, 18 Sep 2009 13:05:53 -0700 Message-ID: <200909182005.n8IK5s2O019506@imap1.linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Cc: linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, jlayton@redhat.com, hannes@cmpxchg.org, hch@lst.de, msb@google.com, rlove@google.com To: viro@zeniv.linux.org.uk Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:38779 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758204AbZIRUMY (ORCPT ); Fri, 18 Sep 2009 16:12:24 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Jeff Layton As Johannes Weiner pointed out, one of the range checks in do_sendfile is redundant and is already checked in rw_verify_area. Signed-off-by: Jeff Layton Reviewed-by: Johannes Weiner Cc: Christoph Hellwig Cc: Al Viro Cc: Robert Love Cc: Mandeep Singh Baines Signed-off-by: Andrew Morton --- fs/read_write.c | 3 --- 1 file changed, 3 deletions(-) diff -puN fs/read_write.c~vfs-remove-redundant-position-check-in-do_sendfile fs/read_write.c --- a/fs/read_write.c~vfs-remove-redundant-position-check-in-do_sendfile +++ a/fs/read_write.c @@ -839,9 +839,6 @@ static ssize_t do_sendfile(int out_fd, i max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes); pos = *ppos; - retval = -EINVAL; - if (unlikely(pos < 0)) - goto fput_out; if (unlikely(pos + count > max)) { retval = -EOVERFLOW; if (pos >= max) _