public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jg at jguk dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/9819] readdir segmentation faults when passed NULL
Date: Sun, 13 Nov 2011 00:51:00 -0000	[thread overview]
Message-ID: <bug-9819-131-XG75EkOsor@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-9819-131@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=9819

--- Comment #8 from Jon Grant <jg at jguk dot org> 2011-11-13 00:51:12 UTC ---
C standard specifies:
"The macro NULL is defined in <stddef.h> (and other headers) as a null pointer
constant; see 7.17."

It's in stddef.h, NULL is not an uninitialised value, NULL is a part of the
language. It's often set by the developer, and other times it's returned by
functions like fopen. For these reasons the "null pointer constant" is
provided, to be checked, not to be a feature of the language that is ignored.

Re read vs fread, I would have thought if(NULL == ptr) would be exactly the
same 4 instruction cost that it is in the user space as kernel.

If read() checking for NULL + returning error code is not standard, really it
should be IMHO. Could be in the POSIX standard.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2011-11-13  0:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-9819-131@http.sourceware.org/bugzilla/>
2011-09-27 21:46 ` jg at jguk dot org
2011-09-28  3:12 ` bugdal at aerifal dot cx
2011-10-03 23:52 ` jg at jguk dot org
2011-10-04  0:36 ` bugdal at aerifal dot cx
2011-10-28 23:59 ` jg at jguk dot org
2011-10-29  0:19 ` bugdal at aerifal dot cx
2011-11-13  0:51 ` jg at jguk dot org [this message]
2014-07-01 20:58 ` fweimer at redhat dot com
2009-02-04 17:53 [Bug libc/9819] New: " rbanfield at weogeo dot com
2009-02-04 18:05 ` [Bug libc/9819] " drepper at redhat dot com

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=bug-9819-131-XG75EkOsor@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).