It seems to me that the comments describing m_getm2 are inconsistent with the behaviour. The comment states that the function returns the top of the newly allocated chain, but it in fact returns the top of the overall chain. Fix: To return the top of the newly allocated chain, the last statement in line 151 would need to be changed from return (m); to return (nm); and the very last else-clause before that is not needed. How-To-Repeat: N/A
State Changed From-To: open->feedback To which part of the tree does this apply?
Sorry, I'm not familiar with the development tree. I've found it in /usr/src/sys/kern/uipc_mbuf.c on a 7.2-RELEASE system. Thanks, Martin
State Changed From-To: feedback->open feedback received.
----- Forwarded message from Martin Karsten <mkarsten@cs.uwaterloo.ca> ----- From: Martin Karsten <mkarsten@cs.uwaterloo.ca> To: linimon@FreeBSD.org CC: freebsd-bugs@FreeBSD.org Subject: Re: kern/134355: comments for m_getm2 inconsistent with behaviour Sorry, I'm not familiar with the development tree. I've found it in /usr/src/sys/kern/uipc_mbuf.c on a 7.2-RELEASE system. Thanks, Martin linimon@FreeBSD.org wrote: > Old Synopsis: cooments for m_getm2 inconsistent with behaviour > New Synopsis: comments for m_getm2 inconsistent with behaviour > > State-Changed-From-To: open->feedback > State-Changed-By: linimon > State-Changed-When: Fri May 8 03:36:00 UTC 2009 > State-Changed-Why: > To which part of the tree does this apply? > > http://www.freebsd.org/cgi/query-pr.cgi?pr=134355 ----- End forwarded message -----
State Changed From-To: open->analyzed Martin, thank you for your submission. In the first place I thought you've found a code bug but while carefully analyzing usage of m_getm2(), I haven't been able to to find a sign of trouble. I agree current implementation isn't intentional and might easily lead into misuse of m_getmw() but the function is rarely used. I think the issue can be solved by "fixing" the leading comment by something like the following. --- uipc_mbuf.c.orig 2009-06-17 22:03:53.000000000 +0200 +++ uipc_mbuf.c 2009-06-17 22:06:24.000000000 +0200 @@ -90,8 +90,9 @@ * Allocate a given length worth of mbufs and/or clusters (whatever fits * best) and return a pointer to the top of the allocated chain. If an * existing mbuf chain is provided, then we will append the new chain - * to the existing one but still return the top of the newly allocated - * chain. + * to the existing one but still return the top of the pre-existing + * chain. If no pre-existing mbuf chain is given, we return the top + * of the new allocated mbuf chain. */ struct mbuf * m_getm2(struct mbuf *m, int len, int how, short type, int flags)
Responsible Changed From-To: freebsd-bugs->andre Take over.
For the following conditions Product: Base System, Documentation Status: New, Open, In Progress, UNCONFIRMED Assignee: Former FreeBSD committer Reset to default assignee. Reset status to "Open".
Committed in base r343500; will be closed after MFC
It appears that this has been fixed in all supported releases.