This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Avoid bogus pointer->int cast


On 07/17/2012 04:31 PM, Ralf Corsepius wrote:
>> Rather than "fixing" the bogus pointer check, why not just nuke that
>> code altogether?
> 
> My goal was to make the existing code compilable by removing invalid
> code, not rewrite it.

Ergo, remove ALL of that bogus code, not just the one line bogus cast.

>> ...and here is just stupid.  POSIX already states that behavior is
>> undefined if you pass in a bogus pointer; and in a compliant program,
>> readdir should only ever be called on a valid pointer, making this check
>> look like nothing more than dead code.  I see no need to bloat the code
>> with an attempt to gracefully deal with a bogus pointer.
> 
> This is a different issue than I was addressing.

Maybe, but solving the issue my way happens to solve your issue as a
nice side effect, with even more bogus code deletion along the way.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]