summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>2001-05-11 17:20:09 +0000
committeraaron <aaron@openbsd.org>2001-05-11 17:20:09 +0000
commitcd37de7620988c0c47c4d9e96df12ac647d7b4d2 (patch)
treef124b652ca64da3446129fac1db2b3edf96e2ee0 /sys/netinet
parent-1 -> MAP_FAILED. (diff)
downloadwireguard-openbsd-cd37de7620988c0c47c4d9e96df12ac647d7b4d2.tar.xz
wireguard-openbsd-cd37de7620988c0c47c4d9e96df12ac647d7b4d2.zip
Check m_pullup() and m_pullup2() return for NULL, not 0; itojun@ ok
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/fil.c4
-rw-r--r--sys/netinet/igmp.c4
-rw-r--r--sys/netinet/ip_icmp.c8
-rw-r--r--sys/netinet/ip_input.c10
-rw-r--r--sys/netinet/ip_ipip.c6
-rw-r--r--sys/netinet/ipsec_input.c6
-rw-r--r--sys/netinet/ipsec_output.c8
-rw-r--r--sys/netinet/tcp_input.c6
-rw-r--r--sys/netinet/udp_usrreq.c5
9 files changed, 29 insertions, 28 deletions
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;
}