linux-mips
[Top] [All Lists]

Re: pread and pwrite

To: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: pread and pwrite
From: Carsten Langgaard <carstenl@mips.com>
Date: Wed, 17 Jul 2002 16:18:17 +0200
Cc: "H. J. Lu" <hjl@lucon.org>, linux-mips@oss.sgi.com
References: <3D3532FB.E227A5AD@mips.com> <20020717155930.A25258@dea.linux-mips.net>
Sender: owner-linux-mips@oss.sgi.com
Ralf Baechle wrote:

> On Wed, Jul 17, 2002 at 11:03:55AM +0200, Carsten Langgaard wrote:
>
> >
> > Here there is some checking for sane values and a proper error value is
> > return.
> > I guess this routine is replaced, if we have the syscall implemented
> > with the sysdeps/unix/sysv/linux/mips/pread.c file.
> > Here there is no check for sane values, is there any reason why ?
> > The same thing goes for pwrite.
>
> The kernel does it's own error checking.  No need to duplicate that in
> userspace.

The kernel doesn't do this a proper check then.
The pread/pwrite parameters is also convert in glibc, the 'offset' is
convert from a 'long' to a 'long long', but it isn't sign extended.
So when pread is call with offset -1, then kernel won't see it as -1.

>
>   Ralf

--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com




<Prev in Thread] Current Thread [Next in Thread>