From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 17 20:13:21 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5BC81065673; Wed, 17 Jun 2009 20:13:21 +0000 (UTC) (envelope-from vwe@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C4D198FC14; Wed, 17 Jun 2009 20:13:21 +0000 (UTC) (envelope-from vwe@FreeBSD.org) Received: from freefall.freebsd.org (vwe@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HKDLX7004580; Wed, 17 Jun 2009 20:13:21 GMT (envelope-from vwe@freefall.freebsd.org) Received: (from vwe@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n5HKDL4S004576; Wed, 17 Jun 2009 20:13:21 GMT (envelope-from vwe) Date: Wed, 17 Jun 2009 20:13:21 GMT Message-Id: <200906172013.n5HKDL4S004576@freefall.freebsd.org> To: mkarsten@cs.uwaterloo.ca, vwe@FreeBSD.org, freebsd-bugs@FreeBSD.org From: vwe@FreeBSD.org Cc: Subject: Re: kern/134355: [mbuf] comments for m_getm2 inconsistent with behaviour X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 20:13:22 -0000 Old Synopsis: [kernel] comments for m_getm2 inconsistent with behaviour New Synopsis: [mbuf] comments for m_getm2 inconsistent with behaviour State-Changed-From-To: open->analyzed State-Changed-By: vwe State-Changed-When: Wed Jun 17 20:07:52 UTC 2009 State-Changed-Why: 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) http://www.freebsd.org/cgi/query-pr.cgi?pr=134355