Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2013 22:53:27 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>, Mark Murray <markm@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r257535 - head/sys/netgraph
Message-ID:  <CAJ-VmokeP5Z2d7jZ-j-Thrh_VuQBKGpKC9nWG%2BQfhR0f6wzF9w@mail.gmail.com>
In-Reply-To: <20131102151309.A1102@besplex.bde.org>
References:  <201311020011.rA20BchL020170@svn.freebsd.org> <20131102151309.A1102@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hm! A good question!

On 1 November 2013 22:22, Bruce Evans <brde@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?



-adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokeP5Z2d7jZ-j-Thrh_VuQBKGpKC9nWG%2BQfhR0f6wzF9w>