lkml.org 
[lkml]   [2009]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] vfs: remove redundant checks in do_sendfile
On Fri, 7 Aug 2009 13:58:33 -0700
Mandeep Singh Baines <msb@google.com> wrote:

> Jeff Layton (jlayton@redhat.com) wrote:
> > As Johannes Weiner pointed out, a couple of the range checks in do_sendfile
> > are redundant and are already checked in rw_verify_area.
> >
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> > fs/read_write.c | 11 -----------
> > 1 files changed, 0 insertions(+), 11 deletions(-)
> >
> > diff --git a/fs/read_write.c b/fs/read_write.c
> > index 6c8c55d..9c3d98b 100644
> > --- a/fs/read_write.c
> > +++ b/fs/read_write.c
> > @@ -792,7 +792,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
> > {
> > struct file * in_file, * out_file;
> > struct inode * in_inode, * out_inode;
> > - loff_t pos;
> > ssize_t retval;
> > int fput_needed_in, fput_needed_out, fl;
> >
> > @@ -838,17 +837,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
> > if (!max)
> > 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;
>
> Agree. This check is redundant.
>
> > - if (unlikely(pos + count > max)) {
>
> rw_verify_area does not check s_maxbytes so aren't the checks against
> max still required?
>

Good catch. That's what I get for not touching these patches for a few weeks :)

I'll fix and resend in another day or so.

> > - retval = -EOVERFLOW;
> > - if (pos >= max)
> > - goto fput_out;
> > - count = max - pos;
> > - }
> > -
> > fl = 0;
> > #if 0
> > /*
> > --
> > 1.6.0.6
> >


--
Jeff Layton <jlayton@redhat.com>


\
 
 \ /
  Last update: 2009-08-07 23:09    [W:0.044 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site