From owner-freebsd-net Sat Jun 1 4:35:52 2002 Delivered-To: freebsd-net@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 6A7A937B409 for ; Sat, 1 Jun 2002 04:35:47 -0700 (PDT) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 1 Jun 2002 12:35:44 +0100 (BST) Date: Sat, 1 Jun 2002 12:35:39 +0100 From: David Malone To: Archie Cobbs Cc: Julian Elischer , Bosko Milekic , freebsd-net@FreeBSD.ORG Subject: Re: m_split() considered harmful Message-ID: <20020601113539.GA45658@walton.maths.tcd.ie> References: <200205312025.g4VKP9t02205@arch20m.dellroad.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200205312025.g4VKP9t02205@arch20m.dellroad.org> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, May 31, 2002 at 01:25:09PM -0700, Archie Cobbs wrote: > As a temporary saftey measure, I'll add M_WRITABLE(m) into the > M_TRAILINGSPACE() macro. However, I see this as a temporary hack; > the correct fix is to put the burden of writability on the caller. > After all, M_TRAILINGSPACE() doesn't modify the mbuf data! I think adding the M_WRITABLE check to M_TRAILINGSPACE is probably the right thing to do, unless the cost of the extra M_WRITABLE checks is likely to be significant. I believe the only reason we didn't add it when we did the M_WRITABLE code originally was to preserve the previous behaviour of M_TRAILINGSPACE. I think it was Ian that pointed out that there is no reason to call M_{LEAD,TRAIL}INGSPACE unless you are going to write into the mbuf's storage. This means the question of where to check writability is just a trade off between efficiency and ease of use. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message