public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H . J . Lu" <hjl@valinux.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: lseek/llseek allows the negative offset
Date: Sat, 18 Nov 2000 19:46:24 -0800	[thread overview]
Message-ID: <20001118194624.A27451@valinux.com> (raw)
In-Reply-To: <20001117155913.A26622@valinux.com> <20001117160900.A27010@valinux.com> <20001118192542.B24555@athlon.random> <20001119014512.G26779@athlon.random> <20001118172034.A22523@valinux.com> <20001119040704.A31148@athlon.random>
In-Reply-To: <20001119040704.A31148@athlon.random>; from andrea@suse.de on Sun, Nov 19, 2000 at 04:07:04AM +0100

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/

  reply	other threads:[~2000-11-19  4:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-17 23:59 lseek/llseek allows the negative offset H . J . Lu
2000-11-18  0:09 ` H . J . Lu
2000-11-18 18:25   ` Andrea Arcangeli
2000-11-18 22:41     ` H . J . Lu
2000-11-19  0:45     ` Andrea Arcangeli
2000-11-19  1:20       ` H . J . Lu
2000-11-19  3:07         ` Andrea Arcangeli
2000-11-19  3:46           ` H . J . Lu [this message]
2000-11-20  1:56         ` Andrea Arcangeli

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=20001118194624.A27451@valinux.com \
    --to=hjl@valinux.com \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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