diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-05-11 17:20:13 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-05-11 17:20:13 +0000 |
commit | c3c13d7458f1ad5ad8bf5d2194e6b97bc8889f5a (patch) | |
tree | 1e3e73f116d9558b78db79cd0fe2cd0ee7a88c8f | |
parent | 8819d23adec5eb15027bcf9a8e810b950082d96e (diff) |
Check m_pullup() and m_pullup2() return for NULL, not 0; itojun@ ok
-rw-r--r-- | sys/net/if_arcsubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_atmsubr.c | 5 | ||||
-rw-r--r-- | sys/net/if_gre.c | 8 | ||||
-rw-r--r-- | sys/netinet/fil.c | 4 | ||||
-rw-r--r-- | sys/netinet/igmp.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 10 | ||||
-rw-r--r-- | sys/netinet/ip_ipip.c | 6 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 6 | ||||
-rw-r--r-- | sys/netinet/ipsec_output.c | 8 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 6 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 5 | ||||
-rw-r--r-- | sys/netinet6/in6_gif.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 4 |
14 files changed, 42 insertions, 40 deletions
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 7e9cf578852..b84d955ee0b 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_arcsubr.c,v 1.5 1997/02/24 13:33:57 niklas Exp $ */ +/* $OpenBSD: if_arcsubr.c,v 1.6 2001/05/11 17:20:09 aaron Exp $ */ /* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */ /* @@ -248,7 +248,7 @@ arc_output(ifp, m0, dst, rt0) if (m == 0) senderr(ENOBUFS); m = m_pullup(m, ARC_HDRNEWLEN); - if (m == 0) + if (m == NULL) senderr(ENOBUFS); ah = mtod(m, struct arc_header *); ah->arc_type = atype; diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index a139bcc053c..b81fecc5354 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atmsubr.c,v 1.13 2000/09/12 04:09:11 itojun Exp $ */ +/* $OpenBSD: if_atmsubr.c,v 1.14 2001/05/11 17:20:10 aaron Exp $ */ /* * @@ -298,7 +298,8 @@ atm_input(ifp, ah, m, rxhand) */ if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) { struct atmllc *alc; - if (m->m_len < sizeof(*alc) && (m = m_pullup(m, sizeof(*alc))) == 0) + if (m->m_len < sizeof(*alc) && + (m = m_pullup(m, sizeof(*alc))) == NULL) return; /* failed */ alc = mtod(m, struct atmllc *); if (bcmp(alc, ATMLLC_HDR, 6)) { diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 7b8145f8d9c..2d5f6217de4 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.9 2001/03/25 07:10:47 csapuntz Exp $ */ +/* $OpenBSD: if_gre.c,v 1.10 2001/05/11 17:20:10 aaron Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -196,7 +196,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (m->m_len < sizeof(struct ip)) { m = m_pullup(m, sizeof(struct ip)); - if (m == 0) { + if (m == NULL) { IF_DROP(&ifp->if_snd); recursions = 0; return (ENOBUFS); @@ -207,7 +207,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (m->m_len < inp->ip_hl << 2) { m = m_pullup(m, sizeof(inp->ip_hl << 2)); - if (m == 0) { + if (m == NULL) { IF_DROP(&ifp->if_snd); recursions = 0; return (ENOBUFS); @@ -292,7 +292,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, case AF_INET: if (m->m_len < sizeof(struct ip)) { m = m_pullup(m, sizeof(struct ip)); - if (m == 0) { + if (m == NULL) { IF_DROP(&ifp->if_snd); recursions = 0; return (ENOBUFS); diff --git a/sys/netinet/fil.c b/sys/netinet/fil.c index 8bd963cdbee..5d6a67fb890 100644 --- a/sys/netinet/fil.c +++ b/sys/netinet/fil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fil.c,v 1.29 2001/05/08 19:58:01 fgsch Exp $ */ +/* $OpenBSD: fil.c,v 1.30 2001/05/11 17:20:11 aaron Exp $ */ /* * Copyright (C) 1993-2000 by Darren Reed. @@ -870,7 +870,7 @@ int out; ip = (ip_t *)hbuf; # else /* __ sgi */ # ifndef linux - if ((*mp = m_pullup(m, up)) == 0) { + if ((*mp = m_pullup(m, up)) == NULL) { ATOMIC_INCL(frstats[out].fr_pull[1]); return -1; } else { diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 5380ff5d09f..5d711584719 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.8 2000/04/25 19:05:43 aaron Exp $ */ +/* $OpenBSD: igmp.c,v 1.9 2001/05/11 17:20:11 aaron Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -153,7 +153,7 @@ igmp_input(m, va_alist) } minlen = iphlen + IGMP_MINLEN; if ((m->m_flags & M_EXT || m->m_len < minlen) && - (m = m_pullup(m, minlen)) == 0) { + (m = m_pullup(m, minlen)) == NULL) { ++igmpstat.igps_rcv_tooshort; return; } diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index fab0f4352b0..65f604a7bf6 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.33 2001/03/28 20:03:03 angelos Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.34 2001/05/11 17:20:11 aaron Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -259,7 +259,7 @@ icmp_input(m, va_alist) goto freeit; } i = hlen + min(icmplen, ICMP_ADVLENMIN); - if (m->m_len < i && (m = m_pullup(m, i)) == 0) { + if (m->m_len < i && (m = m_pullup(m, i)) == NULL) { icmpstat.icps_tooshort++; return; } @@ -392,8 +392,8 @@ icmp_input(m, va_alist) icmpstat.icps_badlen++; goto freeit; } else { - if (!(m = m_pullup(m, (ip->ip_hl << 2) + - ICMP_V6ADVLEN(icp)))) { + if ((m = m_pullup(m, (ip->ip_hl << 2) + + ICMP_V6ADVLEN(icp))) == NULL) { icmpstat.icps_tooshort++; return; } diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 906638fac6d..ecb8b7e8730 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.67 2001/05/01 09:55:49 provos Exp $ */ +/* $OpenBSD: ip_input.c,v 1.68 2001/05/11 17:20:11 aaron Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -330,7 +330,7 @@ ipv4_input(struct mbuf *m, ...) goto bad; ipstat.ips_total++; if (m->m_len < sizeof (struct ip) && - (m = m_pullup(m, sizeof (struct ip))) == 0) { + (m = m_pullup(m, sizeof (struct ip))) == NULL) { ipstat.ips_toosmall++; return; } @@ -345,7 +345,7 @@ ipv4_input(struct mbuf *m, ...) goto bad; } if (hlen > m->m_len) { - if ((m = m_pullup(m, hlen)) == 0) { + if ((m = m_pullup(m, hlen)) == NULL) { ipstat.ips_badhlen++; return; } @@ -436,7 +436,7 @@ ipv4_input(struct mbuf *m, ...) extern struct socket *ip_mrouter; if (m->m_flags & M_EXT) { - if ((m = m_pullup(m, hlen)) == 0) { + if ((m = m_pullup(m, hlen)) == NULL) { ipstat.ips_toosmall++; return; } @@ -534,7 +534,7 @@ ours: */ if (ip->ip_off &~ (IP_DF | IP_RF)) { if (m->m_flags & M_EXT) { /* XXX */ - if ((m = m_pullup(m, hlen)) == 0) { + if ((m = m_pullup(m, hlen)) == NULL) { ipstat.ips_toosmall++; return; } diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 02ab27cd7f2..40542d7cbcd 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.13 2001/04/14 00:30:59 angelos Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.14 2001/05/11 17:20:11 aaron Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -190,7 +190,7 @@ ipip_input(struct mbuf *m, int iphlen) /* Bring the IP header in the first mbuf, if not there already */ if (m->m_len < hlen) { - if ((m = m_pullup(m, hlen)) == 0) + if ((m = m_pullup(m, hlen)) == NULL) { DPRINTF(("ipip_input(): m_pullup() failed\n")); ipipstat.ipips_hdrops++; @@ -250,7 +250,7 @@ ipip_input(struct mbuf *m, int iphlen) /* Bring the inner IP header in the first mbuf, if not there already */ if (m->m_len < hlen) { - if ((m = m_pullup(m, hlen)) == 0) + if ((m = m_pullup(m, hlen)) == NULL) { DPRINTF(("ipip_input(): m_pullup() failed\n")); ipipstat.ipips_hdrops++; diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 2655b16bd05..214b1155c93 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.36 2001/04/06 04:42:08 csapuntz Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.37 2001/05/11 17:20:11 aaron Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -277,7 +277,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff) /* Fix IPv4 header */ if (tdbp->tdb_dst.sa.sa_family == AF_INET) { - if ((m->m_len < skip) && ((m = m_pullup(m, skip)) == 0)) + if ((m->m_len < skip) && ((m = m_pullup(m, skip)) == NULL)) { DPRINTF(("ipsec_common_input_cb(): processing failed for SA %s/%08x\n", ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); IPSEC_ISTAT(espstat.esps_hdrops, ahstat.ahs_hdrops); @@ -365,7 +365,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff) if (af == INET6) { if ((m->m_len < sizeof(struct ip6_hdr)) && - ((m = m_pullup(m, sizeof(struct ip6_hdr))) == 0)) + ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL)) { DPRINTF(("ipsec_common_input_cb(): processing failed for SA %s/%08x\n", ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); IPSEC_ISTAT(espstat.esps_hdrops, ahstat.ahs_hdrops); diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c index 25733e5dcd4..486a85c1535 100644 --- a/sys/netinet/ipsec_output.c +++ b/sys/netinet/ipsec_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_output.c,v 1.6 2001/04/14 00:30:59 angelos Exp $ */ +/* $OpenBSD: ipsec_output.c,v 1.7 2001/05/11 17:20:11 aaron Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -156,7 +156,7 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready, /* Bring the network header in the first mbuf */ if (m->m_len < i) { - if ((m = m_pullup(m, i)) == 0) + if ((m = m_pullup(m, i)) == NULL) return ENOBUFS; } @@ -191,7 +191,7 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready, if (af == AF_INET) { if (m->m_len < sizeof(struct ip)) - if ((m = m_pullup(m, sizeof(struct ip))) == 0) + if ((m = m_pullup(m, sizeof(struct ip))) == NULL) return ENOBUFS; ip = mtod(m, struct ip *); @@ -206,7 +206,7 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready, if (af == AF_INET6) { if (m->m_len < sizeof(struct ip6_hdr)) - if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == 0) + if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) return ENOBUFS; if (m->m_pkthdr.len - sizeof(*ip6) > IPV6_MAXPACKET) { diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 220b75badbd..c60e411c34f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.85 2001/05/01 01:13:05 aaron Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.86 2001/05/11 17:20:11 aaron Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -472,7 +472,7 @@ tcp_input(m, va_alist) if (m->m_len < iphlen + sizeof(struct tcphdr)) { m = m_pullup2(m, iphlen + sizeof(struct tcphdr)); - if (m == 0) { + if (m == NULL) { tcpstat.tcps_rcvshort++; return; } @@ -559,7 +559,7 @@ tcp_input(m, va_alist) tlen -= off; if (off > sizeof(struct tcphdr)) { if (m->m_len < iphlen + off) { - if ((m = m_pullup2(m, iphlen + off)) == 0) { + if ((m = m_pullup2(m, iphlen + off)) == NULL) { tcpstat.tcps_rcvshort++; return; } diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index da11deee254..6afae145697 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.56 2001/03/28 20:03:07 angelos Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.57 2001/05/11 17:20:12 aaron Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -223,7 +223,8 @@ udp_input(m, va_alist) * Get IP and UDP header together in first mbuf. */ if (m->m_len < iphlen + sizeof(struct udphdr)) { - if ((m = m_pullup2(m, iphlen + sizeof(struct udphdr))) == 0) { + if ((m = m_pullup2(m, iphlen + sizeof(struct udphdr))) == + NULL) { udpstat.udps_hdrops++; return; } diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index a6825ac73d9..771c2db26bf 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_gif.c,v 1.12 2001/04/14 00:30:59 angelos Exp $ */ +/* $OpenBSD: in6_gif.c,v 1.13 2001/05/11 17:20:12 aaron Exp $ */ /* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */ /* @@ -122,7 +122,7 @@ in6_gif_output(ifp, family, m, rt) { if (m->m_len < sizeof(struct ip)) { m = m_pullup(m, sizeof(struct ip)); - if (!m) + if (m == NULL) return ENOBUFS; } hlen = (mtod(m, struct ip *)->ip_hl) << 2; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 533b73a7ec2..888ab5a1136 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.29 2001/03/30 11:09:01 itojun Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.30 2001/05/11 17:20:12 aaron Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -260,7 +260,7 @@ ip6_input(m) if (m->m_len < sizeof(struct ip6_hdr)) { struct ifnet *inifp; inifp = m->m_pkthdr.rcvif; - if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == 0) { + if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { ip6stat.ip6s_toosmall++; in6_ifstat_inc(inifp, ifs6_in_hdrerr); return; |