From owner-svn-src-projects@FreeBSD.ORG Fri Feb 3 11:20:11 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90C791065670; Fri, 3 Feb 2012 11:20:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C2E98FC1B; Fri, 3 Feb 2012 11:20:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13BKBNS084993; Fri, 3 Feb 2012 11:20:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13BKBF2084991; Fri, 3 Feb 2012 11:20:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202031120.q13BKBF2084991@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 3 Feb 2012 11:20:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230939 - projects/multi-fibv6/head/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 11:20:11 -0000 Author: bz Date: Fri Feb 3 11:20:11 2012 New Revision: 230939 URL: http://svn.freebsd.org/changeset/base/230939 Log: Minor optimization doing input validation with a possible early return before doing further work. Sponsored by: Cisco Systems, Inc. Modified: projects/multi-fibv6/head/sys/net/route.c Modified: projects/multi-fibv6/head/sys/net/route.c ============================================================================== --- projects/multi-fibv6/head/sys/net/route.c Fri Feb 3 11:00:53 2012 (r230938) +++ projects/multi-fibv6/head/sys/net/route.c Fri Feb 3 11:20:11 2012 (r230939) @@ -1406,6 +1406,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int dst = ifa->ifa_addr; netmask = ifa->ifa_netmask; } + if (dst->sa_len == 0) + return(EINVAL); switch (dst->sa_family) { case AF_INET6: case AF_INET: @@ -1427,8 +1429,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int startfib = fibnum; endfib = fibnum; } - if (dst->sa_len == 0) - return(EINVAL); /* * If it's a delete, check that if it exists,