From owner-freebsd-current@FreeBSD.ORG Fri Sep 17 17:57:33 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBF4416A4CE; Fri, 17 Sep 2004 17:57:33 +0000 (GMT) Received: from mail.broadpark.no (mail.broadpark.no [217.13.4.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36C0E43D4C; Fri, 17 Sep 2004 17:57:33 +0000 (GMT) (envelope-from des@des.no) Received: from dwp.des.no (37.80-203-228.nextgentel.com [80.203.228.37]) by mail.broadpark.no (Postfix) with ESMTP id 782571A87; Fri, 17 Sep 2004 19:58:12 +0200 (MEST) Received: by dwp.des.no (Postfix, from userid 2602) id 2CA92B85E; Fri, 17 Sep 2004 19:57:32 +0200 (CEST) To: Brooks Davis References: <200409170741.i8H7fGV3011078@pooker.samsco.org> <20040917162535.GA5750@odin.ac.hmc.edu> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Fri, 17 Sep 2004 19:57:32 +0200 In-Reply-To: <20040917162535.GA5750@odin.ac.hmc.edu> (Brooks Davis's message of "Fri, 17 Sep 2004 09:25:35 -0700") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable cc: re@FreeBSD.org cc: current@FreeBSD.org Subject: Re: 5.3-RELEASE TODO X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2004 17:57:34 -0000 Brooks Davis writes: > I've got a patch for this one. If someone will review it, I will commit > it to HEAD for further testing. you shouldn't call malloc() with M_NOWAIT unless you absolutely must, and in this case you don't. there's nothing to prevent the ifconf data from growing between the first and second pass, since you're not holding the lock. you'd end up overflowing ifrbuf. what I suggest you do is: struct sbuf *sb =3D sbuf_new(NULL, NULL, size, ifc->ifc_len + 1); acquire(lock); sbuf_bcat(sb, foo, foo_len); sbuf_bcat(sb, bar, bar_len); sbuf_bcat(sb, baz, baz_len); release(lock); sbuf_finish(sb); ifc->ifc_len =3D sbuf_len(); copyout(sbuf_data(), ifc->ifc_req, ifc->ifc_len); sbuf_delete(sb); DES --=20 Dag-Erling Sm=F8rgrav - des@des.no