On 8/16/16 4:32 PM, Ravi Pokala wrote:
> -----Original Message-----
> From: <owner-src-committ...@freebsd.org> on behalf of Bryan Drewery 
> <bdrew...@freebsd.org>
> Organization: FreeBSD
> Date: 2016-08-16, Tuesday at 03:30
> To: Ngie Cooper <yaneurab...@gmail.com>, Konstantin Belousov 
> <k...@freebsd.org>
> Cc: <src-committ...@freebsd.org>, <svn-src-all@freebsd.org>, 
> <svn-src-h...@freebsd.org>
> Subject: Re: svn commit: r304011 - head/libexec/rtld-elf
> 
>> On 8/12/16 7:34 PM, Ngie Cooper wrote:
>>>
>>> ...
>>>
>>>> Log:
>>>>  Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
>>>
>>> Why?
>>>
>>
>> It's a somewhat error-prone and dangerous macro. See r302908.
> 
> I'll grant you "error-prone", but why do you consider it "dangerous"? It's 
> inefficient to walk the whole list when passing NULL as the starting pointer, 
> but I'm not sure what the danger is.
> 

I don't mean "dangerous" here as in security, but as in "doing the right
thing" or "doing what is expected", which it did not as seen in r302908.
 Granted, the original commit for _FROM noted this problem, but it is
very much not obvious.

> And, if it really *is* dangerous, perhaps we should purge the 
> TAILQ_FOREACH_FROM APIs entirely? It looks like rtld-elf was the last 
> (in-tree) user:
> 

I'm not a fan of having it with this behavior, but I understand why it
was designed like this.

>     [freebsd/base/head] rpokala% grep -rl TAILQ_FOREACH_FROM .
>     ./share/man/man3/Makefile
>     ./share/man/man3/queue.3
>     ./sys/sys/queue.h
> 
> I confirmed that queue.h just defines the (S)TAILQ_FOREACH_FROM(_SAFE) 
> macros, but doesn't use them internally to define anything else.
> 
> -Ravi (rpokala@)
> 
>> -- 
>> Regards,
>> Bryan Drewery 
> 
> 
> 


-- 
Regards,
Bryan Drewery

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to