Code nit questions...

Andre Oppermann andre at freebsd.org
Fri May 13 08:58:29 PDT 2005


gnn at 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


More information about the freebsd-net mailing list