svn commit: r257535 - head/sys/netgraph

Mark R V Murray mark at grondar.org
Sat Nov 2 09:32:59 UTC 2013


On 2 Nov 2013, at 05:53, Adrian Chadd <adrian at freebsd.org> wrote:

> Hm! A good question!
> 
> On 1 November 2013 22:22, Bruce Evans <brde at optusnet.com.au> wrote:
> 
>>>        if (harvest.point_to_point)
>>> -               random_harvest(&(m->m_data), 12, 2, RANDOM_NET_NG);
>> 
>> 
>> '&(m->m_data)' is not just a pair of style bugs.  It gives address of
>> the pointer (somewhere in the mbuf header), not the address of pointed-
>> to data, so the randomness was almost null.  The style bugs are
>> excessive parentheses and chumminess with the implementation (non-use
>> of the accessor function mtod()).
>> 
>> 
>>> +               random_harvest(mtod(m, const void *), 12, 2,
>>> RANDOM_NET_NG);
>> 
>> 
>> Presumably you really do want to harvest the pointed-to data and there
>> are at least 12 bytes of it, so the semantic fix isn't backwards or a
>> buffer overrun.
>> 
> 
> 
> Mark - did you initially mean the address of the mbuf m_data pointer,
> or the data payload itself?

As Bruce says - the address of payload data itself. We don’t have 12-byte pointers in FreeBSD. :-)

M
-- 
Mark R V Murray

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 353 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20131102/75d33661/attachment.sig>


More information about the svn-src-head mailing list