diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-05-13 10:42:48 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-05-13 10:42:48 +0000 |
commit | 752beb6c0c0e7329a60fd312719cd7a410162aa1 (patch) | |
tree | 1f811530e56b8d078e3a88c20203c6b15af4da30 | |
parent | 889970baeca780212c1953e389cafda53b2d471e (diff) |
test mbuf pointers against NULL not 0
ok krw@ miod@
-rw-r--r-- | sys/arch/macppc/dev/if_bm.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/if/if_de.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/if/if_qe.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/if/sgec.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/am7990.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/am79900.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/dp8390.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/i82596.c | 10 | ||||
-rw-r--r-- | sys/dev/isa/if_eg.c | 10 | ||||
-rw-r--r-- | sys/dev/isa/if_el.c | 10 | ||||
-rw-r--r-- | sys/dev/isa/if_ie.c | 12 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_cnw.c | 10 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_xe.c | 8 | ||||
-rw-r--r-- | sys/dev/sbus/be.c | 4 | ||||
-rw-r--r-- | sys/kern/sys_socket.c | 12 | ||||
-rw-r--r-- | sys/net/bpf.c | 4 | ||||
-rw-r--r-- | sys/net/bpf_filter.c | 8 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 4 | ||||
-rw-r--r-- | sys/net/raw_usrreq.c | 6 | ||||
-rw-r--r-- | sys/net/rtsock.c | 18 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_ipip.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 12 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 10 | ||||
-rw-r--r-- | sys/netinet6/udp6_output.c | 4 |
29 files changed, 101 insertions, 101 deletions
diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index 0e290d226ec..45f4da2146a 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bm.c,v 1.31 2015/02/09 03:09:57 dlg Exp $ */ +/* $OpenBSD: if_bm.c,v 1.32 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */ /*- @@ -618,7 +618,7 @@ bmac_start(struct ifnet *ifp) return; IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; #if NBPFILTER > 0 /* @@ -685,7 +685,7 @@ bmac_get(struct bmac_softc *sc, caddr_t pkt, int totlen) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return (0); m->m_pkthdr.len = totlen; len = MHLEN; @@ -695,7 +695,7 @@ bmac_get(struct bmac_softc *sc, caddr_t pkt, int totlen) while (totlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return (0); } diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c index 832e018025a..cc895ab8c8e 100644 --- a/sys/arch/vax/if/if_de.c +++ b/sys/arch/vax/if/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.27 2015/02/01 15:27:11 miod Exp $ */ +/* $OpenBSD: if_de.c,v 1.28 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */ /* @@ -352,7 +352,7 @@ destart(ifp) return; for (nxmit = ds->ds_nxmit; nxmit < NXMT; nxmit++) { IF_DEQUEUE(&ds->ds_if.if_snd, m); - if (m == 0) + if (m == NULL) break; rp = &ds->ds_xrent[ds->ds_xfree]; if (rp->r_flags & XFLG_OWN) diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 3033563c04c..fae242274a7 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.31 2015/04/07 14:02:51 mpi Exp $ */ +/* $OpenBSD: if_qe.c,v 1.32 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -440,7 +440,7 @@ qestart(struct ifnet *ifp) } idx = sc->sc_nexttx; IFQ_POLL(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) goto out; /* * Count number of mbufs in chain. diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index 22ce74a10b5..4c459bdee94 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.27 2015/05/02 14:33:19 jsg Exp $ */ +/* $OpenBSD: sgec.c,v 1.28 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -385,7 +385,7 @@ zestart(ifp) } idx = sc->sc_nexttx; IF_DEQUEUE(&sc->sc_if.if_snd, m); - if (m == 0) + if (m == NULL) goto out; /* * Count number of mbufs in chain. diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index 2957d8ca6c6..8524336db79 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7990.c,v 1.50 2015/05/01 14:56:18 mpi Exp $ */ +/* $OpenBSD: am7990.c,v 1.51 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $ */ /*- @@ -485,7 +485,7 @@ am7990_start(struct ifnet *ifp) } IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; #if NBPFILTER > 0 diff --git a/sys/dev/ic/am79900.c b/sys/dev/ic/am79900.c index feb473c6957..c0a624698f2 100644 --- a/sys/dev/ic/am79900.c +++ b/sys/dev/ic/am79900.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am79900.c,v 1.4 2015/05/01 14:56:18 mpi Exp $ */ +/* $OpenBSD: am79900.c,v 1.5 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $ */ /*- @@ -508,7 +508,7 @@ am79900_start(struct ifnet *ifp) } IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; #if NBPFILTER > 0 diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index ded155a89c4..353f1ed3ef8 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.51 2015/04/30 20:55:23 mpi Exp $ */ +/* $OpenBSD: dp8390.c,v 1.52 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -440,7 +440,7 @@ outloop: return; } IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) return; /* We need to use m->m_pkthdr.len, so require the header */ diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index adf3c5b71a6..907ea78ecc3 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.41 2015/05/01 16:37:32 mpi Exp $ */ +/* $OpenBSD: i82596.c,v 1.42 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -982,7 +982,7 @@ i82596_get(struct ie_softc *sc, int head, int totlen) resid = totlen; MGETHDR(m0, M_DONTWAIT, MT_DATA); - if (m0 == 0) + if (m0 == NULL) return (0); m0->m_pkthdr.len = totlen; len = MHLEN; @@ -1013,7 +1013,7 @@ i82596_get(struct ie_softc *sc, int head, int totlen) totlen -= len; if (totlen > 0) { MGET(newm, M_DONTWAIT, MT_DATA); - if (newm == 0) + if (newm == NULL) goto bad; len = MLEN; m = m->m_next = newm; @@ -1099,7 +1099,7 @@ i82596_readframe(sc, num) m = i82596_get(sc, bstart, pktlen); i82596_release_rbd_list(sc, bstart, bend); - if (m == 0) { + if (m == NULL) { sc->sc_arpcom.ac_if.if_ierrors++; return (0); } @@ -1231,7 +1231,7 @@ i82596_start(ifp) } IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) break; /* We need to use m->m_pkthdr.len, so require the header */ diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 4ebf30ca756..71e4fbea36d 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_eg.c,v 1.36 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: if_eg.c,v 1.37 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */ /* @@ -521,7 +521,7 @@ egstart(struct ifnet *ifp) loop: /* Dequeue the next datagram. */ IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) return; ifp->if_flags |= IFF_OACTIVE; @@ -682,7 +682,7 @@ egread(struct eg_softc *sc, caddr_t buf, int len) /* Pull packet off interface. */ m = egget(sc, buf, len); - if (m == 0) { + if (m == NULL) { ifp->if_ierrors++; return; } @@ -712,7 +712,7 @@ egget(struct eg_softc *sc, caddr_t buf, int totlen) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return (0); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = totlen; @@ -723,7 +723,7 @@ egget(struct eg_softc *sc, caddr_t buf, int totlen) while (totlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return (0); } diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index 66315aa02b6..ac2d81dad2c 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_el.c,v 1.24 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: if_el.c,v 1.25 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_el.c,v 1.39 1996/05/12 23:52:32 mycroft Exp $ */ /* @@ -314,7 +314,7 @@ elstart(ifp) IFQ_DEQUEUE(&ifp->if_snd, m0); /* If there's nothing to send, return. */ - if (m0 == 0) + if (m0 == NULL) break; #if NBPFILTER > 0 @@ -502,7 +502,7 @@ elread(sc, len) /* Pull packet off interface. */ m = elget(sc, len); - if (m == 0) { + if (m == NULL) { ifp->if_ierrors++; return; } @@ -537,7 +537,7 @@ elget(sc, totlen) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return 0; m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = totlen; @@ -551,7 +551,7 @@ elget(sc, totlen) while (totlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return 0; } diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index d15ead7ca13..2c2b1cf0d7d 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.40 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: if_ie.c,v 1.41 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */ /*- @@ -1258,7 +1258,7 @@ ieget(sc, ehp, to_bpf) } MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return 0; m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if; m->m_pkthdr.len = totlen; @@ -1273,7 +1273,7 @@ ieget(sc, ehp, to_bpf) while (totlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return 0; } @@ -1344,7 +1344,7 @@ ie_readframe(sc, num) int num; /* frame number to read */ { int status; - struct mbuf *m = 0; + struct mbuf *m = NULL; struct ether_header eh; #if NBPFILTER > 0 int bpf_gets_it = 0; @@ -1367,7 +1367,7 @@ ie_readframe(sc, num) #endif ie_drop_packet_buffer(sc); } - if (m == 0) { + if (m == NULL) { sc->sc_arpcom.ac_if.if_ierrors++; return; } @@ -1465,7 +1465,7 @@ iestart(ifp) } IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) break; /* We need to use m->m_pkthdr.len, so require the header */ diff --git a/sys/dev/pcmcia/if_cnw.c b/sys/dev/pcmcia/if_cnw.c index 0f6019103b9..ffdb6712cb9 100644 --- a/sys/dev/pcmcia/if_cnw.c +++ b/sys/dev/pcmcia/if_cnw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnw.c,v 1.27 2015/03/14 03:38:49 jsg Exp $ */ +/* $OpenBSD: if_cnw.c,v 1.28 2015/05/13 10:42:46 jsg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -462,7 +462,7 @@ cnw_start(ifp) } IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) return; #if NBPFILTER > 0 @@ -557,7 +557,7 @@ cnw_read(sc) bufptr = 0; /* XXX make gcc happy */ MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return (0); m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if; m->m_pkthdr.len = totbytes; @@ -568,7 +568,7 @@ cnw_read(sc) while (totbytes > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return (0); } @@ -649,7 +649,7 @@ cnw_recv(sc) CNW_CMD0(sc, CNW_CMD_SRP); /* Did we manage to get the packet from the interface? */ - if (m == 0) { + if (m == NULL) { ++ifp->if_ierrors; return; } diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c index d07b7398e7a..c98bff5c62b 100644 --- a/sys/dev/pcmcia/if_xe.c +++ b/sys/dev/pcmcia/if_xe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xe.c,v 1.47 2015/03/14 03:38:49 jsg Exp $ */ +/* $OpenBSD: if_xe.c,v 1.48 2015/05/13 10:42:46 jsg Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas @@ -771,7 +771,7 @@ xe_get(sc) recvcount += pktlen; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return (recvcount); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = pktlen; @@ -782,7 +782,7 @@ xe_get(sc) while (pktlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); return (recvcount); } @@ -1097,7 +1097,7 @@ xe_start(ifp) /* Peek at the next packet. */ IFQ_POLL(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) return; /* We need to use m->m_pkthdr.len, so require the header. */ diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 3beb83baf55..04fae5de770 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.29 2015/04/07 14:59:06 mpi Exp $ */ +/* $OpenBSD: be.c,v 1.30 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -580,7 +580,7 @@ bestart(struct ifnet *ifp) for (;;) { IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; #if NBPFILTER > 0 diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index df1c92719b2..6272c3458e6 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.19 2014/07/13 15:52:38 tedu Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.20 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -57,8 +57,8 @@ int soo_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { - return (soreceive((struct socket *)fp->f_data, (struct mbuf **)0, - uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0, + return (soreceive((struct socket *)fp->f_data, (struct mbuf **)NULL, + uio, (struct mbuf **)NULL, (struct mbuf **)NULL, (int *)NULL, (socklen_t)0)); } @@ -67,8 +67,8 @@ int soo_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { - return (sosend((struct socket *)fp->f_data, (struct mbuf *)0, - uio, (struct mbuf *)0, (struct mbuf *)0, 0)); + return (sosend((struct socket *)fp->f_data, (struct mbuf *)NULL, + uio, (struct mbuf *)NULL, (struct mbuf *)NULL, 0)); } int @@ -125,7 +125,7 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) if (IOCGROUP(cmd) == 'r') return (rtioctl(cmd, data, p)); return ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL, - (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)0, p)); + (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)NULL, p)); } int diff --git a/sys/net/bpf.c b/sys/net/bpf.c index f76c855a8e1..5626c73fef0 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.118 2015/02/10 21:56:10 miod Exp $ */ +/* $OpenBSD: bpf.c,v 1.119 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -1157,7 +1157,7 @@ bpf_mcopy(const void *src_arg, void *dst_arg, size_t len) m = src_arg; dst = dst_arg; while (len > 0) { - if (m == 0) + if (m == NULL) panic("bpf_mcopy"); count = min(m->m_len, len); bcopy(mtod(m, caddr_t), (caddr_t)dst, count); diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c index 755e4a5a794..93da2943e05 100644 --- a/sys/net/bpf_filter.c +++ b/sys/net/bpf_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf_filter.c,v 1.26 2014/09/19 11:43:31 otto Exp $ */ +/* $OpenBSD: bpf_filter.c,v 1.27 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: bpf_filter.c,v 1.12 1996/02/13 22:00:00 christos Exp $ */ /* @@ -76,7 +76,7 @@ while (k >= len) { \ k -= len; \ m = m->m_next; \ - if (m == 0) \ + if (m == NULL) \ return 0; \ len = m->m_len; \ } \ @@ -102,7 +102,7 @@ bpf_m_xword(struct mbuf *m, u_int32_t k, int *err) return EXTRACT_LONG(cp); } m0 = m->m_next; - if (m0 == 0 || m0->m_len + len - k < 4) + if (m0 == NULL || m0->m_len + len - k < 4) return 0; *err = 0; np = mtod(m0, u_char *); @@ -134,7 +134,7 @@ bpf_m_xhalf(struct mbuf *m, u_int32_t k, int *err) return EXTRACT_SHORT(cp); } m0 = m->m_next; - if (m0 == 0) + if (m0 == NULL) return 0; *err = 0; return (cp[0] << 8) | mtod(m0, u_char *)[0]; diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index e924037f9c9..f991c8d71fe 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.82 2015/04/10 13:58:20 dlg Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.83 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -736,7 +736,7 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, * (This assumes M_LEADINGSPACE is always 0 for a cluster mbuf.) */ M_PREPEND(m0, PPP_HDRLEN, M_DONTWAIT); - if (m0 == 0) { + if (m0 == NULL) { error = ENOBUFS; goto bad; } diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index 048da3b7c3f..6f8f7a11bb2 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_usrreq.c,v 1.18 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: raw_usrreq.c,v 1.19 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */ /* @@ -108,7 +108,7 @@ raw_input(struct mbuf *m0, ...) struct mbuf *n; if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { if (sbappendaddr(&last->so_rcv, src, - n, (struct mbuf *)0) == 0) + n, (struct mbuf *)NULL) == 0) /* should notify about lost packet */ m_freem(n); else { @@ -121,7 +121,7 @@ raw_input(struct mbuf *m0, ...) } if (last) { if (sbappendaddr(&last->so_rcv, src, - m, (struct mbuf *)0) == 0) + m, (struct mbuf *)NULL) == 0) m_freem(m); else { sorwakeup(last); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index c46de81c5a3..eb221a75b6b 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.158 2015/05/05 09:41:43 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.159 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -304,7 +304,7 @@ rt_senddesync(void *data) desync_mbuf = rt_msg1(RTM_DESYNC, NULL); if ((desync_mbuf != NULL) && (sbappendaddr(&rp->rcb_socket->so_rcv, &route_src, - desync_mbuf, (struct mbuf *)0) != 0)) { + desync_mbuf, (struct mbuf *)NULL) != 0)) { rop->flags &= ~ROUTECB_FLAG_DESYNC; sorwakeup(rp->rcb_socket); } else { @@ -405,7 +405,7 @@ route_input(struct mbuf *m0, ...) if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { if (sbspace(&last->so_rcv) < (2 * MSIZE) || sbappendaddr(&last->so_rcv, sosrc, - n, (struct mbuf *)0) == 0) { + n, (struct mbuf *)NULL) == 0) { /* * Flag socket as desync'ed and * flush required @@ -426,7 +426,7 @@ route_input(struct mbuf *m0, ...) if (last) { if (sbspace(&last->so_rcv) < (2 * MSIZE) || sbappendaddr(&last->so_rcv, sosrc, - m, (struct mbuf *)0) == 0) { + m, (struct mbuf *)NULL) == 0) { /* Flag socket as desync'ed and flush required */ sotoroutecb(last)->flags |= ROUTECB_FLAG_DESYNC | ROUTECB_FLAG_FLUSH; @@ -468,7 +468,7 @@ route_output(struct mbuf *m, ...) va_end(ap); info.rti_info[RTAX_DST] = NULL; /* for error handling (goto flush) */ - if (m == 0 || ((m->m_len < sizeof(int32_t)) && + if (m == NULL || ((m->m_len < sizeof(int32_t)) && (m = m_pullup(m, sizeof(int32_t))) == 0)) return (ENOBUFS); if ((m->m_flags & M_PKTHDR) == 0) @@ -978,7 +978,7 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo) m = NULL; } } - if (m == 0) + if (m == NULL) return (m); m->m_pkthdr.len = m->m_len = hlen = len; m->m_pkthdr.rcvif = NULL; @@ -1092,7 +1092,7 @@ rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, if (route_cb.any_count == 0) return; m = rt_msg1(type, rtinfo); - if (m == 0) + if (m == NULL) return; rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; @@ -1121,7 +1121,7 @@ rt_ifmsg(struct ifnet *ifp) if (route_cb.any_count == 0) return; m = rt_msg1(RTM_IFINFO, NULL); - if (m == 0) + if (m == NULL) return; ifm = mtod(m, struct if_msghdr *); ifm->ifm_index = ifp->if_index; @@ -1188,7 +1188,7 @@ rt_ifannouncemsg(struct ifnet *ifp, int what) if (route_cb.any_count == 0) return; m = rt_msg1(RTM_IFANNOUNCE, NULL); - if (m == 0) + if (m == NULL) return; ifan = mtod(m, struct if_announcemsghdr *); ifan->ifan_index = ifp->if_index; diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 82774bd7905..6a795012c77 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.132 2015/02/05 03:01:03 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.133 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -687,7 +687,7 @@ int icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) { struct ip *ip = mtod(m, struct ip *); - struct mbuf *opts = 0; + struct mbuf *opts = NULL; struct sockaddr_in sin; struct rtentry *rt; int optlen = (ip->ip_hl << 2) - sizeof(struct ip); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 38b140395ab..967c8ddaedb 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.248 2015/04/10 13:58:20 dlg Exp $ */ +/* $OpenBSD: ip_input.c,v 1.249 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -550,7 +550,7 @@ found: ipqe->ipqe_m = m; ipqe->ipqe_ip = ip; m = ip_reass(ipqe, fp); - if (m == 0) { + if (m == NULL) { return; } ipstat.ips_reassembled++; diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 7f104257f66..77756748da2 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.58 2015/04/14 14:20:01 mikeb Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.59 2015/05/13 10:42:46 jsg Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -418,7 +418,7 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, } M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); - if (m == 0) { + if (m == NULL) { DPRINTF(("ipip_output(): M_PREPEND failed\n")); ipipstat.ipips_hdrops++; *mp = NULL; @@ -514,7 +514,7 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, } M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); - if (m == 0) { + if (m == NULL) { DPRINTF(("ipip_output(): M_PREPEND failed\n")); ipipstat.ipips_hdrops++; *mp = NULL; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 92a45e5bcc8..4ec5b23e667 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.279 2015/04/17 11:04:01 mikeb Exp $ */ +/* $OpenBSD: ip_output.c,v 1.280 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -750,7 +750,7 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) mhlen = sizeof (struct ip); for (off = hlen + len; off < ntohs(ip->ip_len); off += len) { MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (m == 0) { + if (m == NULL) { ipstat.ips_odropped++; error = ENOBUFS; goto sendorfree; @@ -848,7 +848,7 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen) ip->ip_dst = p->ipopt_dst; if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { MGETHDR(n, M_DONTWAIT, MT_HEADER); - if (n == 0) + if (n == NULL) return (m); M_MOVE_HDR(n, m); n->m_pkthdr.len += optlen; @@ -1022,7 +1022,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, break; case IP_PORTRANGE: - if (m == 0 || m->m_len != sizeof(int)) + if (m == NULL || m->m_len != sizeof(int)) error = EINVAL; else { optval = *mtod(m, int *); @@ -1058,7 +1058,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, #ifndef IPSEC error = EOPNOTSUPP; #else - if (m == 0 || m->m_len != sizeof(int)) { + if (m == NULL || m->m_len != sizeof(int)) { error = EINVAL; break; } @@ -1310,7 +1310,7 @@ ip_pcbopts(struct mbuf **pcbopt, struct mbuf *m) if (*pcbopt) (void)m_free(*pcbopt); *pcbopt = 0; - if (m == (struct mbuf *)0 || m->m_len == 0) { + if (m == (struct mbuf *)NULL || m->m_len == 0) { /* * Only turning off any previous options. */ diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index cd1bfcfb320..7ecab1e41d4 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.130 2015/04/17 11:04:02 mikeb Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.131 2015/05/13 10:42:46 jsg Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -132,7 +132,7 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto, IPSEC_ISTAT(espstat.esps_input, ahstat.ahs_input, ipcompstat.ipcomps_input); - if (m == 0) { + if (m == NULL) { DPRINTF(("ipsec_common_input(): NULL packet received\n")); IPSEC_ISTAT(espstat.esps_hdrops, ahstat.ahs_hdrops, ipcompstat.ipcomps_hdrops); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 04a32d0cbcf..9e9ba4f1a91 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.289 2015/04/16 19:24:13 markus Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.290 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2850,7 +2850,7 @@ tcp_pulloutofband(struct socket *so, u_int urgent, struct mbuf *m, int off) } cnt -= m->m_len; m = m->m_next; - if (m == 0) + if (m == NULL) break; } panic("tcp_pulloutofband"); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index b98ecd29cba..3637eefcadb 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.141 2015/05/07 09:19:31 mikeb Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.142 2015/05/13 10:42:46 jsg Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -303,8 +303,8 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0, { int tlen; int win = 0; - struct mbuf *m = 0; - struct route *ro = 0; + struct mbuf *m = NULL; + struct route *ro = NULL; struct tcphdr *th; struct ip *ip; #ifdef INET6 diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 3b8ec6a1269..a9a4258a714 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.170 2015/04/17 11:04:02 mikeb Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.171 2015/05/13 10:42:47 jsg Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1056,7 +1056,7 @@ ip6_insert_jumboopt(struct ip6_exthdrs *exthdrs, u_int32_t plen) */ if (exthdrs->ip6e_hbh == 0) { MGET(mopt, M_DONTWAIT, MT_DATA); - if (mopt == 0) + if (mopt == NULL) return (ENOBUFS); mopt->m_len = JUMBOOPTLEN; optbuf = mtod(mopt, u_int8_t *); @@ -1165,7 +1165,7 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen, struct mbuf *mfrg; MGET(mfrg, M_DONTWAIT, MT_DATA); - if (mfrg == 0) + if (mfrg == NULL) return (ENOBUFS); mfrg->m_len = sizeof(struct ip6_frag); *frghdrp = mtod(mfrg, struct ip6_frag *); @@ -1602,7 +1602,7 @@ do { \ #ifndef IPSEC error = EINVAL; #else - if (m == 0 || m->m_len != sizeof(int)) { + if (m == NULL || m->m_len != sizeof(int)) { error = EINVAL; break; } @@ -3106,7 +3106,7 @@ ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs) ip6 = mtod(m, struct ip6_hdr *); if (m->m_len > sizeof(*ip6)) { MGETHDR(mh, M_DONTWAIT, MT_HEADER); - if (mh == 0) { + if (mh == NULL) { m_freem(m); return ENOBUFS; } diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index 686c0391625..874d3088f1b 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp6_output.c,v 1.33 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: udp6_output.c,v 1.34 2015/05/13 10:42:47 jsg Exp $ */ /* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */ /* @@ -182,7 +182,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6, * for UDP and IP6 headers. */ M_PREPEND(m, hlen + sizeof(struct udphdr), M_DONTWAIT); - if (m == 0) { + if (m == NULL) { error = ENOBUFS; goto releaseopt; } |