lkml.org 
[lkml]   [2000]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: lseek/llseek allows the negative offset
On Sun, Nov 19, 2000 at 04:07:04AM +0100, Andrea Arcangeli wrote:
> On Sat, Nov 18, 2000 at 05:20:34PM -0800, H . J . Lu wrote:
> > Try this again 2.2.18pre21. It works for me.
> >
> >
> > --
> > H.J. Lu (hjl@valinux.com)
> > ---
> > --- linux/fs/ext2/file.c.lseek Sat Nov 18 17:18:49 2000
> > +++ linux/fs/ext2/file.c Sat Nov 18 17:19:28 2000
> > @@ -120,6 +120,8 @@ static long long ext2_file_lseek(
> > case 1:
> > offset += file->f_pos;
> > }
> > + if (offset < 0)
> > + return -EINVAL;
> > if (((unsigned long long) offset >> 32) != 0) {
> > #if BITS_PER_LONG < 64
> > return -EINVAL;
>
> It's not enough for 2.2.x (and you left the `>> 32' nosense check).
>

It works for me on ia32. offset is a long long in 2.2.18pre21 on ia32.
I don't see anything wrong for

if (offset < 0)
return -EINVAL;

I got:

lseek(3, 4294967295, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 4294967294, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 4294967293, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 4294967292, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 4294967291, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 2147483647, SEEK_CUR) = -1 EOVERFLOW (Value too large for defined data type)
lseek(3, 2147483647, SEEK_CUR) = -1 EOVERFLOW (Value too large for defined data type)
_llseek(3, 18446744073709551614, 0xbffff980, SEEK_SET) = -1 EINVAL (Invalid argument)
lseek(3, 4294867296, SEEK_SET) = -1 EINVAL (Invalid argument)

My kernel has LFS patch.

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

\
 
 \ /
  Last update: 2005-03-22 12:47    [W:0.056 / U:0.924 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site