lkml.org 
[lkml]   [2006]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs/eventpoll: error handling micro-cleanup
Davide Libenzi wrote:
> On Sun, 1 Oct 2006, Jeff Garzik wrote:
>
>> Davide Libenzi wrote:
>>
>>> I just tried a `find /usr/src/linux-2.6.16/ -type f -exec grep -H -C 2
>>> PTR_ERR {} \;`
>>> and looked at the cases where the error variable is assigned in any case
>>> before the test. Same code pattern as, like:
>>>
>>> error = -EFAULT;
>>> if (copy_from_user(...))
>>> goto kaboom;
>> No, that's quite different. I'm talking about
>>
>> ptr = get_a_pointer_from_somewhere()
>> error = PTR_ERR(ptr)
>>
>> See the difference? The error variable is directly assigned from a
>> potentially-valid pointer.
>
> So? Is PTR_ERR() defined and documented in a way that, if called with a
> valid pointer, has an unexpected/faulty behaviour?

When called with a valid pointer, the value assigned to the return-code
integer is essentially a random number.


> Again, I don't care either ways, but don't tell me you're not sure about
> the countless occurrences. Take a look at:
>
> `find $LINUXSRC -type f -exec grep -H -C 2 PTR_ERR {} \;`

Perhaps 1 out of every 100 or so hits from this find(1) is unprotected
by IS_ERR(). IOW, what I've been describing here is quite rare.

Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-01 19:31    [W:0.044 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site