From: Al Viro <viro@ftp.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-sparse@vger.kernel.org
Subject: Re: comparison of safe pointers
Date: Fri, 25 May 2007 16:44:37 +0100 [thread overview]
Message-ID: <20070525154437.GJ4095@ftp.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.0.98.0705250827460.26602@woody.linux-foundation.org>
On Fri, May 25, 2007 at 08:29:11AM -0700, Linus Torvalds wrote:
>
>
> On Fri, 25 May 2007, Al Viro wrote:
> >
> > What did you want that check in evaluate_compare() to catch? Is that
> > about warning on explicit comparison with NULL?
>
> Yes. It was explicitly meant to be a "anybody who tests this pointer
> missed the 'safe' part of it".
>
> But I never used it, so it was really meant as a concept thing, and I
> don't think it's wrong to test against non-null.
OK... Pointer comparisons care about null pointer constants anyway
(BTW, ordered comparison with NULL should give a warning - it's not
a valid C and it makes no sense whatsoever even as an extension),
so that's not a problem.
Other places that care are ?:, simple assignment when target is a pointer,
passing arguments to function with prototype when parameter type is a pointer
(same logics as with assignment) and cast adding address space (valid for
NULL, not valid for random void *).
AFAICS, that covers everything; definitely all contexts where null pointer
constants are recognized by C and I think that it covers all places where
they matter for sparse extensions...
prev parent reply other threads:[~2007-05-25 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 13:07 comparison of safe pointers Al Viro
2007-05-25 15:29 ` Linus Torvalds
2007-05-25 15:44 ` Al Viro [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=20070525154437.GJ4095@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.