public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: "H . J . Lu" <hjl@valinux.com>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: lseek/llseek allows the negative offset
Date: Mon, 20 Nov 2000 02:56:25 +0100	[thread overview]
Message-ID: <20001120025625.A21625@athlon.random> (raw)
In-Reply-To: <20001117155913.A26622@valinux.com> <20001117160900.A27010@valinux.com> <20001118192542.B24555@athlon.random> <20001119014512.G26779@athlon.random> <20001118172034.A22523@valinux.com>
In-Reply-To: <20001118172034.A22523@valinux.com>; from hjl@valinux.com on Sat, Nov 18, 2000 at 05:20:34PM -0800

On Sat, Nov 18, 2000 at 05:20:34PM -0800, H . J . Lu wrote:
> --- linux/fs/proc/mem.c.lseek	Tue Jan  4 10:12:23 2000
> +++ linux/fs/proc/mem.c	Sat Nov 18 17:19:28 2000
> @@ -196,14 +196,17 @@ static long long mem_lseek(struct file *
>  {
>  	switch (orig) {
>  		case 0:
> -			file->f_pos = offset;
> -			return file->f_pos;
> +			break;
>  		case 1:
> -			file->f_pos += offset;
> -			return file->f_pos;
> +			offset += file->f_pos;
> +			break;
>  		default:
>  			return -EINVAL;
>  	}
> +	if (offset < 0)
> +			return -EINVAL;
> +	file->f_pos = offset;
> +	return offset;
>  }

This looks fine to me.

Andrea
-
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/

      parent reply	other threads:[~2000-11-20  2:27 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
2000-11-20  1:56         ` Andrea Arcangeli [this message]

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=20001120025625.A21625@athlon.random \
    --to=andrea@suse.de \
    --cc=hjl@valinux.com \
    --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