Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Carsten Langgaard <carstenl@mips.com>
To: "H. J. Lu" <hjl@lucon.org>, Ralf Baechle <ralf@oss.sgi.com>,
	linux-mips@oss.sgi.com
Subject: pread and pwrite
Date: Wed, 17 Jul 2002 11:03:55 +0200	[thread overview]
Message-ID: <3D3532FB.E227A5AD@mips.com> (raw)

I'm running some tests from LTP, which tests pread and pwrite.
It look like pread/pwrite doesn't do any check, if they are called with
'buf =NULL' or 'offset < 0', and no error is return.
If I look in glibc in sysdeps/generic/pread.c it look like this:

ssize_t
__libc_pread (int fd, void *buf, size_t nbytes, off_t offset)
{
  if (nbytes == 0)
    return 0;
  if (fd < 0)
    {
      __set_errno (EBADF);
      return -1;
    }
  if (buf == NULL || offset < 0)
    {
      __set_errno (EINVAL);
      return -1;
    }

  __set_errno (ENOSYS);
  return -1;
}

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.

/Carsten

--
_    _ ____  ___   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

             reply	other threads:[~2002-07-17  8:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-17  9:03 Carsten Langgaard [this message]
2002-07-17 13:59 ` pread and pwrite Ralf Baechle
2002-07-17 14:18   ` Carsten Langgaard
2002-07-17 19:01     ` H. J. Lu
2002-07-17 20:14       ` Carsten Langgaard

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=3D3532FB.E227A5AD@mips.com \
    --to=carstenl@mips.com \
    --cc=hjl@lucon.org \
    --cc=linux-mips@oss.sgi.com \
    --cc=ralf@oss.sgi.com \
    /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