Re: comparison of safe pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux