svn commit: r239187 - head/sys/kern

Bruce Evans brde at optusnet.com.au
Sat Aug 11 10:39:48 UTC 2012


On Sat, 11 Aug 2012, Bruce Evans wrote:

> On Sat, 11 Aug 2012, David Xu wrote:
>> ...
>> 	for (;;) {
>> 		if (!(uq->uq_flags & UQF_UMTXQ))
>> 			return (0);
>> -		error = msleep(uq, &uc->uc_lock, PCATCH, wmesg,
>> -		    timo == NULL ? 0 : abs_timeout_gethz(timo));
>> -		if (error != EWOULDBLOCK)
>> -			break;
>> -		umtxq_unlock(&uq->uq_key);
>> -		if (abs_timeout_update(timo)) {
>> -			error = ETIMEDOUT;
> ...
> This follows the null pointer in abs_timeout_update() if timo == NULL.
> timo == NULL has caused msleep to be called with a timeout of 0 ticks
> (infinity), so EWOULDBLOCK should not normally be returned in this
> case.  However, I think it is always returned after the INT_MAX ticks
> since a timeout of infinity is not really infinite, but just INT_MAX,
> and there is no further magic for this value, so EWOULDBLOCK is
> returned as usual if the timeout expires.

Oops, 0 really does mean infinity for msleep(), so there is no problem
unless it somehow returns EWOULDBLOCK.

> ...
>> +		abs_timeout_update(timo);
>
> This still follows the null pointer, as above.

Still no problem.

Bruce


More information about the svn-src-head mailing list