[patch] Avoid bogus pointer->int cast
Eric Blake
eblake@redhat.com
Wed Jul 25 18:36:00 GMT 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20120725/5a0b3ccb/attachment.sig>
More information about the Newlib
mailing list