svn commit: r316826 - head/sys/netpfil/ipfw/nat64

Conrad Meyer cem at freebsd.org
Fri Apr 14 16:21:19 UTC 2017


Ian,

I don't know about "guaranteed," but it certainly looks like the
htonl/bswap macros intend to avoid double-evaluating macro parameters.

On Fri, Apr 14, 2017 at 8:53 AM, Ian Lepore <ian at freebsd.org> wrote:
> On Fri, 2017-04-14 at 08:32 -0700, Conrad Meyer wrote:
>> On Fri, Apr 14, 2017 at 4:58 AM, Andrey V. Elsukov <ae at freebsd.org>
>> wrote:
>> >
>> > Author: ae
>> > Date: Fri Apr 14 11:58:41 2017
>> > New Revision: 316826
>> > URL: https://svnweb.freebsd.org/changeset/base/316826
>> >
>> > Log:
>> >   Avoid undefined behavior.
>> >
>> >   The 'pktid' variable is modified while being used twice between
>> >   sequence points, probably due to htonl() is macro.
>> FYI — there are a ton of similar reports in sys/rpc due to the XDR
>> macros (which read a network value off a pointer and increment it).
>> See e.g., IXDR_GET_UINT32() macro.
>>
>> Best,
>> Conrad
>
> Aren't they all false positives, since the macros involved are g'teed
> not to evaluate their arguments more than once as written (because
> __builtin_constant_p always evaluates at compile time)?  Do we really
> want to churn our source code to eliminate false positives from some
> tool that appears to still be in its alpha-testing state?
>
> -- Ian


More information about the svn-src-all mailing list