From owner-freebsd-net@FreeBSD.ORG Fri May 13 15:58:28 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E184216A4CE for ; Fri, 13 May 2005 15:58:28 +0000 (GMT) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D4C543D82 for ; Fri, 13 May 2005 15:58:27 +0000 (GMT) (envelope-from andre@freebsd.org) Received: (qmail 78329 invoked from network); 13 May 2005 15:56:17 -0000 Received: from unknown (HELO freebsd.org) ([62.48.0.53]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 13 May 2005 15:56:17 -0000 Message-ID: <4284CEA6.CB014AA6@freebsd.org> Date: Fri, 13 May 2005 17:58:30 +0200 From: Andre Oppermann X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: gnn@freebsd.org References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-net@freebsd.org cc: kame Subject: Re: Code nit questions... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 15:58:29 -0000 gnn@freebsd.org wrote: > > Hi Folks, > > In a continuing effort to clean up some code nits in the IPv6 code > I'd like to propose the following diffs. There is a comment, starting > with a *) explaining the problem and proposed fix. > > Let me know. ... > *) Make sure that sro is also valid before de-referencing it. > > Index: in6_src.c > =================================================================== > RCS file: /Volumes/exported/FreeBSD-CVS/src/sys/netinet6/in6_src.c,v > retrieving revision 1.29 > diff -u -r1.29 in6_src.c > --- in6_src.c 7 Jan 2005 02:30:34 -0000 1.29 > +++ in6_src.c 11 May 2005 20:09:30 -0000 > @@ -454,7 +454,7 @@ > > if ((error = in6_selectroute(dstsock, opts, mopts, ro, retifp, > &rt, 0)) != 0) { > - if (rt && rt == sro.ro_rt) > + if (rt && sro && rt == sro.ro_rt) > RTFREE(rt); > return (error); > } AFAIK 'sro' is stack-route which is a 'struct route' on the stack and thus always valid. The orginal check fine as it is. -- Andre