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 05:11 PM, Eric Blake wrote:
> 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.

More concretely, any objections to this patch instead?

2012-07-18  Eric Blake  <eblake@redhat.com>

	* libc/posix/readdir.c (readdir): Drop bogus attempt to catch
	bogus pointers.

diff --git i/newlib/libc/posix/readdir.c w/newlib/libc/posix/readdir.c
index da07d5c..d3187e6 100644
--- i/newlib/libc/posix/readdir.c
+++ w/newlib/libc/posix/readdir.c
@@ -75,12 +75,6 @@ _DEFUN(readdir, (dirp),
       continue;
     }
     dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);
-    if ((int)dp & 03) {	/* bogus pointer check */
-#ifdef HAVE_DD_LOCK
-      __lock_release_recursive(dirp->dd_lock);
-#endif
-      return NULL;
-    }
     if (dp->d_reclen <= 0 ||
 	dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) {
 #ifdef HAVE_DD_LOCK

-- 
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]