diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2001-05-16 12:54:35 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2001-05-16 12:54:35 +0000 |
commit | 60de2c41ea2b387be2e4b7b9b565329dd0a61c36 (patch) | |
tree | 8652597c096bbc850f6862988cd18624122c0051 /sys/net | |
parent | 87f10021e726a2d2d79e079d9fe15180e3023b3e (diff) |
No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bpf.c | 11 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 5 | ||||
-rw-r--r-- | sys/net/if_tun.c | 4 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 7 | ||||
-rw-r--r-- | sys/net/rtsock.c | 7 |
5 files changed, 8 insertions, 26 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 5837e9618ef..f215c49dd60 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.25 2001/04/04 02:39:17 jason Exp $ */ +/* $OpenBSD: bpf.c,v 1.26 2001/05/16 12:53:34 ho Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -169,8 +169,6 @@ bpf_movein(uio, linktype, mp, sockp) return (EIO); MGETHDR(m, M_WAIT, MT_DATA); - if (m == 0) - return (ENOBUFS); m->m_pkthdr.rcvif = 0; m->m_pkthdr.len = len - hlen; @@ -1145,14 +1143,7 @@ bpf_allocbufs(d) register struct bpf_d *d; { d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK); - if (d->bd_fbuf == 0) - return (ENOBUFS); - d->bd_sbuf = (caddr_t)malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK); - if (d->bd_sbuf == 0) { - free(d->bd_fbuf, M_DEVBUF); - return (ENOBUFS); - } d->bd_slen = 0; d->bd_hlen = 0; return (0); diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 46541d79576..d9214c62dcf 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.16 2000/03/21 23:31:27 mickey Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.17 2001/05/16 12:53:34 ho Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -498,9 +498,6 @@ pppioctl(sc, cmd, data, flag, p) newcodelen = nbp->bf_len * sizeof(struct bpf_insn); if (newcodelen != 0) { MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK); - if (newcode == 0) { - return EINVAL; /* or sumpin */ - } if ((error = copyin((caddr_t)nbp->bf_insns, (caddr_t)newcode, newcodelen)) != 0) { FREE(newcode, M_DEVBUF); diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 87282337516..724cae4b2a1 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.33 2001/04/23 13:55:27 art Exp $ */ +/* $OpenBSD: if_tun.c,v 1.34 2001/05/16 12:53:34 ho Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -122,8 +122,6 @@ tunattach(n) ntun = n; tunctl = malloc(ntun * sizeof(*tunctl), M_DEVBUF, M_WAITOK); - if (!tunctl) - return; bzero(tunctl, ntun * sizeof(*tunctl)); for (i = 0; i < ntun; i++) { tunctl[i].tun_flags = TUN_INITED; diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 9be485c26fb..3b41b062d5c 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp_tty.c,v 1.10 2001/03/09 14:56:44 aaron Exp $ */ +/* $OpenBSD: ppp_tty.c,v 1.11 2001/05/16 12:53:34 ho Exp $ */ /* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */ /* @@ -352,10 +352,7 @@ pppwrite(tp, uio, flag) return (EMSGSIZE); for (mp = &m0; uio->uio_resid; mp = &m->m_next) { MGET(m, M_WAIT, MT_DATA); - if ((*mp = m) == NULL) { - m_freem(m0); - return (ENOBUFS); - } + *mp = m; m->m_len = 0; if (uio->uio_resid >= MCLBYTES / 2) MCLGET(m, M_DONTWAIT); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 84cf734dd49..81901fb7c92 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.13 2001/01/19 06:37:37 itojun Exp $ */ +/* $OpenBSD: rtsock.c,v 1.14 2001/05/16 12:53:34 ho Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -120,9 +120,8 @@ route_usrreq(so, req, m, nam, control) if (req == PRU_ATTACH) { MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK); - if ((so->so_pcb = rp) != NULL) - bzero(so->so_pcb, sizeof(*rp)); - + so->so_pcb = rp; + bzero(so->so_pcb, sizeof(*rp)); } if (req == PRU_DETACH && rp) { int af = rp->rcb_proto.sp_protocol; |