diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2021-06-21 22:09:15 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2021-06-21 22:09:15 +0000 |
commit | 58639d1ec9e15147eb7157c53893506e1fc8cb23 (patch) | |
tree | 824720bd58ae741f0e639557459a9ecd08e649f1 /sys/netinet/ip_input.c | |
parent | 54e5d9906c5ca818f6b57b97addcc7a5b36a710e (diff) |
Fix uninitialized variables introduced in rev 1.361
Thankfully clang elided the code in an almost harmless way (at least on
amd64 GENERIC.MP). Spotted by chance when building kernels
with -Wno-error=uninitialized.
ok dlg@ sashan@ bluhm@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index f80669ff911..3915225657e 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.362 2021/06/03 01:55:52 dlg Exp $ */ +/* $OpenBSD: ip_input.c,v 1.363 2021/06/21 22:09:14 jca Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -353,6 +353,8 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp) if (m == NULL) goto bad; + ip = mtod(m, struct ip *); + #if NCARP > 0 if (carp_lsdrop(ifp, m, AF_INET, &ip->ip_src.s_addr, &ip->ip_dst.s_addr, (ip->ip_p == IPPROTO_ICMP ? 0 : 1))) @@ -371,10 +373,11 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp) goto bad; ip = mtod(m, struct ip *); - hlen = ip->ip_hl << 2; pfrdr = (pfrdr != ip->ip_dst.s_addr); #endif + hlen = ip->ip_hl << 2; + /* * Process options and, if not destined for us, * ship it on. ip_dooptions returns 1 when an |