From b3dd0771528e50960d52bf283a5fcc31cb820a1e Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Fri, 3 Feb 2012 11:20:11 +0000 Subject: [PATCH] Minor optimization doing input validation with a possible early return before doing further work. Sponsored by: Cisco Systems, Inc. --- sys/net/route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 3e3e7a5c7212..b4cf6b18affc 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1406,6 +1406,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) 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 flags, int fibnum) startfib = fibnum; endfib = fibnum; } - if (dst->sa_len == 0) - return(EINVAL); /* * If it's a delete, check that if it exists,