From owner-svn-src-all@freebsd.org Fri Sep 18 14:01:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFAC63E3DF3; Fri, 18 Sep 2020 14:01:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BtFqV5bfPz4bfL; Fri, 18 Sep 2020 14:01:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3A181BF51; Fri, 18 Sep 2020 14:01:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08IE1Ajh025623; Fri, 18 Sep 2020 14:01:10 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08IE1AJV025622; Fri, 18 Sep 2020 14:01:10 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202009181401.08IE1AJV025622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 18 Sep 2020 14:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365881 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 365881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2020 14:01:10 -0000 Author: mhorne Date: Fri Sep 18 14:01:10 2020 New Revision: 365881 URL: https://svnweb.freebsd.org/changeset/base/365881 Log: Initialize some local variables earlier Move the initialization of these variables to the beginning of their respective functions. On our end this creates a small amount of unneeded churn, as these variables are properly initialized before their first use in all cases. However, changing this benefits at least one downstream consumer (NetApp) by allowing local and future modifications to these functions to be made without worrying about where the initialization occurs. Reviewed by: melifaro, rscheff Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26454 Modified: head/sys/netinet/ip_output.c head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Sep 18 12:59:27 2020 (r365880) +++ head/sys/netinet/ip_output.c Fri Sep 18 14:01:10 2020 (r365881) @@ -323,11 +323,11 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct rou struct ifnet *ifp = NULL; /* keep compiler happy */ struct mbuf *m0; int hlen = sizeof (struct ip); - int mtu; + int mtu = 0; int error = 0; struct sockaddr_in *dst, sin; const struct sockaddr_in *gw; - struct in_ifaddr *ia; + struct in_ifaddr *ia = NULL; struct in_addr src; int isbroadcast; uint16_t ip_len, ip_off; @@ -485,7 +485,6 @@ again: * possible that a matching SPD entry exists. */ no_route_but_check_spd = 1; - mtu = 0; /* Silence GCC warning. */ goto sendit; #endif IPSTAT_INC(ips_noroute); @@ -521,7 +520,6 @@ again: * possible that a matching SPD entry exists. */ no_route_but_check_spd = 1; - mtu = 0; /* Silence GCC warning. */ goto sendit; #endif IPSTAT_INC(ips_noroute); Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Fri Sep 18 12:59:27 2020 (r365880) +++ head/sys/netinet/udp_usrreq.c Fri Sep 18 14:01:10 2020 (r365881) @@ -1151,7 +1151,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s struct epoch_tracker et; int cscov_partial = 0; int error = 0; - int ipflags; + int ipflags = 0; u_short fport, lport; u_char tos; uint8_t pr; @@ -1435,7 +1435,6 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s ip->ip_off |= htons(IP_DF); } - ipflags = 0; if (inp->inp_socket->so_options & SO_DONTROUTE) ipflags |= IP_ROUTETOIF; if (inp->inp_socket->so_options & SO_BROADCAST)