tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: question about mbuf intialization

On 23/09/2013 10:20 PM, Beverly Schwartz wrote:
Rump uses the actual kernel code, therefore, just like the kernel, m_len will contain what every value was last there, or some random scribble from memory. Writing a rump unit test, there's a lot of grabbing mbufs and trying out different things. I can set m_len and m_pkthdr.len, but it's a nuisance to remember to have to do it with each allocation of an mbuf. -Bev

As has been mentioned earlier in this thread, setting
m_len & co to 0 doesnot make the mbuf "work". They
need to be "non-zero" and set to the sizeof data to
be sent. Or in other words, you need to set these fields
correctlyor nothing will work. Having themintialised
to 0 will not help make anything work.

It may be a better test for whatever allocates the memory
to be used by the mbuf to fill it with 0xff or 0xa55a or
some other pattern like 0xdeadbeef/0xfeedface, etc, so
that it is obvious uninitialised memory is being used.
Given that it is the responsibility of whatever is building
the packet to send to set m_len & co correctly, having
them initialised to 0 should mean that code paths that
don't set them are more easily found.


Home | Main Index | Thread Index | Old Index