Date: Sat, 24 Mar 2018 12:43:34 +0000 (UTC) From: "Jonathan T. Looney" <jtl@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331484 - head/sys/netinet6 Message-ID: <201803241243.w2OChY5f013569@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jtl Date: Sat Mar 24 12:43:34 2018 New Revision: 331484 URL: https://svnweb.freebsd.org/changeset/base/331484 Log: Remove some unneccessary variable sets in IPv6 code, as detected by clang's static analyzer. Reviewed by: bz MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10940 Modified: head/sys/netinet6/dest6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_output.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/dest6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -93,7 +93,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto) opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); /* search header for all options. */ - for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { + for (; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { if (*opt != IP6OPT_PAD1 && (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { IP6STAT_INC(ip6s_toosmall); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/icmp6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -594,7 +594,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n->m_pkthdr.len = n0len + (noff - off); n->m_next = n0; } else { - nip6 = mtod(n, struct ip6_hdr *); IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off, sizeof(*nicmp6)); noff = off; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/ip6_output.c Sat Mar 24 12:43:34 2018 (r331484) @@ -1048,7 +1048,7 @@ sendorfree: m = m0->m_nextpkt; m0->m_nextpkt = 0; m_freem(m0); - for (m0 = m; m; m = m0) { + for (; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = 0; if (error == 0) { Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:43:34 2018 (r331484) @@ -220,7 +220,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) uint8_t nxt; ifp = m->m_pkthdr.rcvif; - ip6 = mtod(m, struct ip6_hdr *); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); @@ -230,6 +229,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh)); if (!uh) return (IPPROTO_DONE); + ip6 = mtod(m, struct ip6_hdr *); #endif UDPSTAT_INC(udps_ipackets);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803241243.w2OChY5f013569>