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 | |
parent | 87f10021e726a2d2d79e079d9fe15180e3023b3e (diff) |
No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)
Diffstat (limited to 'sys')
33 files changed, 76 insertions, 188 deletions
diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c index 1f23f232453..6c4fc16b2a7 100644 --- a/sys/crypto/cryptodev.c +++ b/sys/crypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.c,v 1.7 2001/05/15 09:00:23 deraadt Exp $ */ +/* $OpenBSD: cryptodev.c,v 1.8 2001/05/16 12:54:34 ho Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -278,8 +278,6 @@ crypto_op(struct csession *cse, struct crypt_op *cop, struct proc *p) bzero(&cse->iovec, sizeof(cse->iovec)); cse->uio.uio_iov[0].iov_len = cop->len; cse->uio.uio_iov[0].iov_base = malloc(cop->len, M_XDATA, M_WAITOK); - if (cse->uio.uio_iov[0].iov_base == NULL) - return (ENOMEM); for (i = 0; i < cse->uio.uio_iovcnt; i++) cse->uio.uio_resid += cse->uio.uio_iov[0].iov_len; diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c index dfe83208002..27f71b21d9b 100644 --- a/sys/kern/kern_lkm.c +++ b/sys/kern/kern_lkm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_lkm.c,v 1.29 2001/05/05 20:57:00 art Exp $ */ +/* $OpenBSD: kern_lkm.c,v 1.30 2001/05/16 12:52:58 ho Exp $ */ /* $NetBSD: kern_lkm.c,v 1.31 1996/03/31 21:40:27 christos Exp $ */ /* @@ -155,13 +155,10 @@ lkmalloc() struct lkm_table *ret = NULL; MALLOC(ret, struct lkm_table *, sizeof(*ret), M_DEVBUF, M_WAITOK); - if (ret != NULL) { - ret->refcnt = - ret->depcnt = 0; - ret->id = nlkms++; - ret->sym_id = -1; - TAILQ_INSERT_TAIL(&lkmods, ret, list); - } + ret->refcnt = ret->depcnt = 0; + ret->id = nlkms++; + ret->sym_id = -1; + TAILQ_INSERT_TAIL(&lkmods, ret, list); return ret; } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 595071f1258..5c2b5a3e2c5 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.28 2000/11/10 18:15:47 art Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.29 2001/05/16 12:52:58 ho Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -691,10 +691,7 @@ sys_select(p, v, retval) if (SCARG(uap, nd) > FD_SETSIZE) { caddr_t mbits; - if ((mbits = malloc(ni * 6, M_TEMP, M_WAITOK)) == NULL) { - error = EINVAL; - goto cleanup; - } + mbits = malloc(ni * 6, M_TEMP, M_WAITOK); bzero(mbits, ni * 6); pibits[0] = (fd_set *)&mbits[ni * 0]; pibits[1] = (fd_set *)&mbits[ni * 1]; @@ -779,7 +776,6 @@ done: #undef putbits } -cleanup: if (pibits[0] != &bits[0]) free(pibits[0], M_TEMP); return (error); diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index b3d0ceae796..dbd1a48e201 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_subr.c,v 1.10 2001/01/25 03:50:53 todd Exp $ */ +/* $OpenBSD: tty_subr.c,v 1.11 2001/05/16 12:52:58 ho Exp $ */ /* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */ /* @@ -94,17 +94,10 @@ clalloc(clp, size, quot) { clp->c_cs = malloc(size, M_TTYS, M_WAITOK); - if (!clp->c_cs) - return (-1); bzero(clp->c_cs, size); if (quot) { clp->c_cq = malloc(QMEM(size), M_TTYS, M_WAITOK); - if (!clp->c_cq) { - free(clp->c_cs, M_TTYS); - clp->c_cs = NULL; - return (-1); - } bzero(clp->c_cq, QMEM(size)); } else clp->c_cq = (u_char *)0; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index fddbf376b58..9cba7d90786 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.37 2001/05/14 13:43:54 art Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.38 2001/05/16 12:52:58 ho Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -479,15 +479,10 @@ sendit(p, s, mp, flags, retsize) register struct cmsghdr *cm; M_PREPEND(control, sizeof(*cm), M_WAIT); - if (control == 0) { - error = ENOBUFS; - goto bad; - } else { - cm = mtod(control, struct cmsghdr *); - cm->cmsg_len = control->m_len; - cm->cmsg_level = SOL_SOCKET; - cm->cmsg_type = SCM_RIGHTS; - } + cm = mtod(control, struct cmsghdr *); + cm->cmsg_len = control->m_len; + cm->cmsg_level = SOL_SOCKET; + cm->cmsg_type = SCM_RIGHTS; } #endif } else @@ -919,8 +914,6 @@ sys_getsockname(p, v, retval) return (error); so = (struct socket *)fp->f_data; m = m_getclr(M_WAIT, MT_SONAME); - if (m == NULL) - return (ENOBUFS); error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0); if (error) goto bad; @@ -965,8 +958,6 @@ sys_getpeername(p, v, retval) if (error) return (error); m = m_getclr(M_WAIT, MT_SONAME); - if (m == NULL) - return (ENOBUFS); error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0); if (error) goto bad; 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; diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c index 524b0a946b5..db460d35379 100644 --- a/sys/netatalk/ddp_output.c +++ b/sys/netatalk/ddp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ddp_output.c,v 1.2 2000/06/16 21:47:15 provos Exp $ */ +/* $OpenBSD: ddp_output.c,v 1.3 2001/05/16 12:53:35 ho Exp $ */ /* * Copyright (c) 1990,1991 Regents of The University of Michigan. @@ -212,10 +212,6 @@ ddp_route( m, ro ) } } else { MGET( m0, M_WAIT, MT_HEADER ); - if ( m0 == 0 ) { - m_freem( m ); - return( ENOBUFS ); - } m0->m_next = m; m0->m_len = SZ_ELAPHDR; m = m0; diff --git a/sys/netccitt/pk_input.c b/sys/netccitt/pk_input.c index 7ed158197d9..3168d722bf8 100644 --- a/sys/netccitt/pk_input.c +++ b/sys/netccitt/pk_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk_input.c,v 1.2 1996/03/04 07:36:41 niklas Exp $ */ +/* $OpenBSD: pk_input.c,v 1.3 2001/05/16 12:53:35 ho Exp $ */ /* $NetBSD: pk_input.c,v 1.7 1996/02/13 22:05:21 christos Exp $ */ /* @@ -120,8 +120,6 @@ pk_newlink(ia, llnext) */ size = sizeof(struct pkcb); pkp = (struct pkcb *) malloc(size, M_PCB, M_WAITOK); - if (pkp == 0) - return ((struct pkcb *) 0); bzero((caddr_t) pkp, size); pkp->pk_lloutput = pp->pr_output; pkp->pk_llctlinput = pp->pr_ctlinput; @@ -227,22 +225,16 @@ pk_resize(pkp) pkp->pk_maxlcn = xcp->xc_maxlcn; size = (pkp->pk_maxlcn + 1) * sizeof(struct pklcd *); pkp->pk_chan = malloc(size, M_IFADDR, M_WAITOK); - if (pkp->pk_chan) { - bzero((caddr_t) pkp->pk_chan, size); - /* - * Allocate a logical channel descriptor for lcn 0 - */ - if (dev_lcp == 0 && - (dev_lcp = pk_attach((struct socket *) 0)) == 0) - return (ENOBUFS); - dev_lcp->lcd_state = READY; - dev_lcp->lcd_pkp = pkp; - pkp->pk_chan[0] = dev_lcp; - } else { - if (dev_lcp) - pk_close(dev_lcp); + bzero((caddr_t) pkp->pk_chan, size); + /* + * Allocate a logical channel descriptor for lcn 0 + */ + if (dev_lcp == 0 && + (dev_lcp = pk_attach((struct socket *) 0)) == 0) return (ENOBUFS); - } + dev_lcp->lcd_state = READY; + dev_lcp->lcd_pkp = pkp; + pkp->pk_chan[0] = dev_lcp; } return 0; } diff --git a/sys/netccitt/pk_llcsubr.c b/sys/netccitt/pk_llcsubr.c index 2becb73d7fc..61b32fc48ed 100644 --- a/sys/netccitt/pk_llcsubr.c +++ b/sys/netccitt/pk_llcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk_llcsubr.c,v 1.4 2001/01/19 06:37:37 itojun Exp $ */ +/* $OpenBSD: pk_llcsubr.c,v 1.5 2001/05/16 12:53:35 ho Exp $ */ /* $NetBSD: pk_llcsubr.c,v 1.4 1996/02/13 22:05:26 christos Exp $ */ /* @@ -331,10 +331,8 @@ npaidb_enter(key, value, rt, link) npdl_netmask.sdl_data[i] = -1; nprt->rt_llinfo = malloc(size, M_PCB, M_WAITOK); - if (nprt->rt_llinfo) { - bzero(nprt->rt_llinfo, size); - ((struct npaidbentry *) (nprt->rt_llinfo))->np_rt = rt; - } + bzero(nprt->rt_llinfo, size); + ((struct npaidbentry *) (nprt->rt_llinfo))->np_rt = rt; } else nprt->rt_refcnt--; return nprt; diff --git a/sys/netccitt/pk_usrreq.c b/sys/netccitt/pk_usrreq.c index 8fa4c9b476c..24e1e334a74 100644 --- a/sys/netccitt/pk_usrreq.c +++ b/sys/netccitt/pk_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk_usrreq.c,v 1.2 1996/03/04 07:36:47 niklas Exp $ */ +/* $OpenBSD: pk_usrreq.c,v 1.3 2001/05/16 12:53:35 ho Exp $ */ /* $NetBSD: pk_usrreq.c,v 1.10 1996/02/13 22:05:43 christos Exp $ */ /* @@ -360,8 +360,6 @@ pk_control(so, cmd, data, ifp) if (ifa == (struct ifaddr *) 0) { MALLOC(ia, struct x25_ifaddr *, sizeof(*ia), M_IFADDR, M_WAITOK); - if (ia == 0) - return (ENOBUFS); bzero((caddr_t) ia, sizeof(*ia)); TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); @@ -570,7 +568,7 @@ pk_send(m, v) if (m->m_pkthdr.len > 32) error = EMSGSIZE; M_PREPEND(m, PKHEADERLN, M_WAITOK); - if (m == 0 || error) + if (error) goto bad; *(mtod(m, octet *)) = 0; xp = mtod(m, struct x25_packet *); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 3237049f8c2..17ef1ebcb7d 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.18 2000/10/06 05:52:00 itojun Exp $ */ +/* $OpenBSD: in.c,v 1.19 2001/05/16 12:53:35 ho Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -237,8 +237,6 @@ in_control(so, cmd, data, ifp) if (ia == (struct in_ifaddr *)0) { ia = (struct in_ifaddr *) malloc(sizeof *ia, M_IFADDR, M_WAITOK); - if (ia == (struct in_ifaddr *)0) - return (ENOBUFS); bzero((caddr_t)ia, sizeof *ia); TAILQ_INSERT_TAIL(&in_ifaddr, ia, ia_list); TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index bef3b9beb6a..48d96b5452b 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.89 2001/04/14 00:30:59 angelos Exp $ */ +/* $OpenBSD: ip_output.c,v 1.90 2001/05/16 12:53:36 ho Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -1224,8 +1224,6 @@ ip_setmoptions(optname, imop, m) imo = (struct ip_moptions *)malloc(sizeof(*imo), M_IPMOPTS, M_WAITOK); - if (imo == NULL) - return (ENOBUFS); *imop = imo; imo->imo_multicast_ifp = NULL; imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index dc69615df10..86f324d2150 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.26 2001/02/16 15:58:50 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.27 2001/05/16 12:53:36 ho Exp $ */ /* $KAME: in6.c,v 1.176 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -429,8 +429,6 @@ in6_control(so, cmd, data, ifp, p) if (ia == NULL) { ia = (struct in6_ifaddr *) malloc(sizeof(*ia), M_IFADDR, M_WAITOK); - if (ia == NULL) - return (ENOBUFS); bzero((caddr_t)ia, sizeof(*ia)); /* Initialize the address and masks */ ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 901dddb226d..7fa15e90167 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.32 2001/04/14 00:30:59 angelos Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.33 2001/05/16 12:53:36 ho Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1775,8 +1775,6 @@ ip6_setmoptions(optname, im6op, m) im6o = (struct ip6_moptions *) malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); - if (im6o == NULL) - return(ENOBUFS); *im6op = im6o; im6o->im6o_multicast_ifp = NULL; im6o->im6o_multicast_hlim = ip6_defmcasthlim; @@ -1940,10 +1938,7 @@ ip6_setmoptions(optname, im6op, m) * address list for the given interface. */ imm = malloc(sizeof(*imm), M_IPMADDR, M_WAITOK); - if (imm == NULL) { - error = ENOBUFS; - break; - } + if ((imm->i6mm_maddr = in6_addmulti(&mreq->ipv6mr_multiaddr, ifp, &error)) == NULL) { free(imm, M_IPMADDR); diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c index 1107eb32c58..30a337cb289 100644 --- a/sys/netipx/ipx.c +++ b/sys/netipx/ipx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx.c,v 1.9 2000/01/15 18:52:13 fgsch Exp $ */ +/* $OpenBSD: ipx.c,v 1.10 2001/05/16 12:54:06 ho Exp $ */ /*- * @@ -101,8 +101,6 @@ ipx_control(so, cmd, data, ifp) if (ia == (struct ipx_ifaddr *)NULL) { ia = (struct ipx_ifaddr *) malloc(sizeof(*ia), M_IFADDR, M_WAITOK); - if (ia == (struct ipx_ifaddr *)NULL) - return (ENOBUFS); bzero((caddr_t)ia, sizeof(*ia)); TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); diff --git a/sys/netiso/clnp_raw.c b/sys/netiso/clnp_raw.c index 67694c2b68d..287f31d7494 100644 --- a/sys/netiso/clnp_raw.c +++ b/sys/netiso/clnp_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clnp_raw.c,v 1.2 1996/03/04 10:34:59 mickey Exp $ */ +/* $OpenBSD: clnp_raw.c,v 1.3 2001/05/16 12:54:06 ho Exp $ */ /* $NetBSD: clnp_raw.c,v 1.9 1996/02/13 22:08:42 christos Exp $ */ /*- @@ -314,8 +314,6 @@ clnp_usrreq(so, req, m, nam, control) if (rp) panic("rip_attach"); MALLOC(rp, struct rawisopcb *, sizeof *rp, M_PCB, M_WAITOK); - if (rp == 0) - return (ENOBUFS); bzero(rp, sizeof *rp); so->so_pcb = rp; break; diff --git a/sys/netiso/esis.c b/sys/netiso/esis.c index 10b4b86674e..6cf5d0a0409 100644 --- a/sys/netiso/esis.c +++ b/sys/netiso/esis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esis.c,v 1.4 1996/05/10 12:31:21 deraadt Exp $ */ +/* $OpenBSD: esis.c,v 1.5 2001/05/16 12:54:06 ho Exp $ */ /* $NetBSD: esis.c,v 1.14 1996/05/07 02:45:04 thorpej Exp $ */ /*- @@ -184,13 +184,11 @@ esis_usrreq(so, req, m, nam, control) break; } MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK); - if ((so->so_pcb = rp) != NULL) { - bzero(so->so_pcb, sizeof(*rp)); - LIST_INSERT_HEAD(&esis_pcb, rp, rcb_list); - rp->rcb_socket = so; - error = soreserve(so, esis_sendspace, esis_recvspace); - } else - error = ENOBUFS; + so->so_pcb = rp; + bzero(so->so_pcb, sizeof(*rp)); + LIST_INSERT_HEAD(&esis_pcb, rp, rcb_list); + rp->rcb_socket = so; + error = soreserve(so, esis_sendspace, esis_recvspace); break; case PRU_SEND: diff --git a/sys/netiso/if_cons.c b/sys/netiso/if_cons.c index 99af200fc70..4c7dc72fa03 100644 --- a/sys/netiso/if_cons.c +++ b/sys/netiso/if_cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cons.c,v 1.2 1996/03/04 10:35:21 mickey Exp $ */ +/* $OpenBSD: if_cons.c,v 1.3 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: if_cons.c,v 1.7 1996/02/13 22:09:44 christos Exp $ */ /*- @@ -595,8 +595,6 @@ make_partial_x25_packet(isop, lcp) return 0; } MGETHDR(m, M_WAITOK, MT_DATA); - if (m == 0) - return ENOBUFS; buf = mtod(m, caddr_t); ptr = buf; diff --git a/sys/netiso/iso.c b/sys/netiso/iso.c index b9385efee65..c11334c58e9 100644 --- a/sys/netiso/iso.c +++ b/sys/netiso/iso.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iso.c,v 1.3 1996/04/21 22:29:25 deraadt Exp $ */ +/* $OpenBSD: iso.c,v 1.4 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: iso.c,v 1.14 1996/04/13 01:34:48 cgd Exp $ */ /*- @@ -488,8 +488,6 @@ iso_control(so, cmd, data, ifp) #endif MALLOC(ia, struct iso_ifaddr *, sizeof(*ia), M_IFADDR, M_WAITOK); - if (ia == 0) - return (ENOBUFS); bzero((caddr_t) ia, sizeof(*ia)); TAILQ_INSERT_TAIL(&iso_ifaddr, ia, ia_list); TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *) ia, diff --git a/sys/netiso/tp.trans b/sys/netiso/tp.trans index f8ec072e064..7101080e1a0 100644 --- a/sys/netiso/tp.trans +++ b/sys/netiso/tp.trans @@ -1,4 +1,4 @@ -/* $OpenBSD: tp.trans,v 1.2 1996/03/04 10:35:46 mickey Exp $ */ +/* $OpenBSD: tp.trans,v 1.3 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: tp.trans,v 1.4 1994/06/29 06:39:55 cgd Exp $ */ /* NEW */ @@ -420,13 +420,11 @@ TP_CRSENT <== TP_CLOSED T_CONN_req $P.tp_ucddata, 0, 0); ENDTRACE data = MCPY($P.tp_ucddata, M_WAIT); - if (data) { - IFDEBUG(D_CONN) - printf("T_CONN_req.trans m_copy cc 0x%x\n", - $P.tp_ucddata); - dump_mbuf(data, "sosnd @ T_CONN_req"); - ENDDEBUG - } + IFDEBUG(D_CONN) + printf("T_CONN_req.trans m_copy cc 0x%x\n", + $P.tp_ucddata); + dump_mbuf(data, "sosnd @ T_CONN_req"); + ENDDEBUG if (error = tp_emit(CR_TPDU_type, $P, 0, 0, data) ) return error; /* driver WON'T change state; will return error */ diff --git a/sys/netiso/tp_driver.c b/sys/netiso/tp_driver.c index 55db1bde56d..c2df0f0ee08 100644 --- a/sys/netiso/tp_driver.c +++ b/sys/netiso/tp_driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_driver.c,v 1.4 1998/04/04 02:55:57 don Exp $ */ +/* $OpenBSD: tp_driver.c,v 1.5 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: tp_driver.c,v 1.8 1996/03/16 23:13:45 christos Exp $ */ #include "tp_states.h" @@ -161,15 +161,13 @@ _Xebec_action(a, e, p) (int) p->tp_flags, p->tp_ucddata, 0, 0); #endif data = MCPY(p->tp_ucddata, M_WAIT); - if (data) { #ifdef ARGO_DEBUG - if (argo_debug[D_CONN]) { - printf("T_CONN_req.trans m_copy cc %p\n", - p->tp_ucddata); - dump_mbuf(data, "sosnd @ T_CONN_req"); - } -#endif + if (argo_debug[D_CONN]) { + printf("T_CONN_req.trans m_copy cc %p\n", + p->tp_ucddata); + dump_mbuf(data, "sosnd @ T_CONN_req"); } +#endif if ((error = tp_emit(CR_TPDU_type, p, 0, 0, data)) != 0) return error; /* driver WON'T change state; * will return error */ diff --git a/sys/netiso/tp_subr.c b/sys/netiso/tp_subr.c index 602b452fc84..73bcff21107 100644 --- a/sys/netiso/tp_subr.c +++ b/sys/netiso/tp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_subr.c,v 1.3 1996/04/21 22:29:57 deraadt Exp $ */ +/* $OpenBSD: tp_subr.c,v 1.4 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: tp_subr.c,v 1.8 1996/03/16 23:14:00 christos Exp $ */ /*- @@ -721,10 +721,9 @@ tp_packetize(tpcb, m, eotsdu) while (m) { n = m; - if (totlen > maxsize) { - if ((m = m_split(n, maxsize, M_WAIT)) == 0) - panic("tp_packetize"); - } else + if (totlen > maxsize) + m = m_split(n, maxsize, M_WAIT); + else m = 0; totlen -= maxsize; tpsbcheck(tpcb, 5); diff --git a/sys/netiso/tp_usrreq.c b/sys/netiso/tp_usrreq.c index 7c6f03cec22..8b3e4caf987 100644 --- a/sys/netiso/tp_usrreq.c +++ b/sys/netiso/tp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_usrreq.c,v 1.3 1996/04/21 22:30:04 deraadt Exp $ */ +/* $OpenBSD: tp_usrreq.c,v 1.4 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: tp_usrreq.c,v 1.9 1996/03/16 23:14:06 christos Exp $ */ /*- @@ -329,9 +329,6 @@ tp_sendoob(tpcb, so, xdata, outflags) if (xdata == (struct mbuf *) 0) { /* empty xpd packet */ MGETHDR(xdata, M_WAIT, MT_OOBDATA); - if (xdata == NULL) { - return ENOBUFS; - } xdata->m_len = 0; xdata->m_pkthdr.len = 0; } diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index bff8f2468ae..e3f6a5f8f88 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: natm.c,v 1.5 1997/10/11 01:32:08 angelos Exp $ */ +/* $OpenBSD: natm.c,v 1.6 2001/05/16 12:54:08 ho Exp $ */ /* * @@ -246,10 +246,6 @@ struct proc *p; */ M_PREPEND(m, sizeof(*aph), M_WAITOK); - if (m == NULL) { - error = ENOBUFS; - break; - } aph = mtod(m, struct atm_pseudohdr *); ATM_PH_VPI(aph) = npcb->npcb_vpi; ATM_PH_SETVCI(aph, npcb->npcb_vci); diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c index 74c06708f89..06bd49a5a57 100644 --- a/sys/netnatm/natm_pcb.c +++ b/sys/netnatm/natm_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: natm_pcb.c,v 1.3 1996/11/09 03:29:00 chuck Exp $ */ +/* $OpenBSD: natm_pcb.c,v 1.4 2001/05/16 12:54:08 ho Exp $ */ /* * @@ -67,10 +67,6 @@ int wait; MALLOC(npcb, struct natmpcb *, sizeof(*npcb), M_PCB, wait); -#ifdef DIAGNOSTIC - if (wait == M_WAITOK && npcb == NULL) panic("npcb_alloc: malloc didn't wait"); -#endif - if (npcb) { bzero(npcb, sizeof(*npcb)); npcb->npcb_flags = NPCB_FREE; diff --git a/sys/netns/ns.c b/sys/netns/ns.c index 338c3701394..a72458f2f5e 100644 --- a/sys/netns/ns.c +++ b/sys/netns/ns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns.c,v 1.2 1996/03/04 08:20:22 niklas Exp $ */ +/* $OpenBSD: ns.c,v 1.3 2001/05/16 12:54:07 ho Exp $ */ /* $NetBSD: ns.c,v 1.10 1996/02/13 22:13:49 christos Exp $ */ /* @@ -131,8 +131,6 @@ ns_control(so, cmd, data, ifp) if (ia == 0) { ia = (struct ns_ifaddr *) malloc(sizeof *ia, M_IFADDR, M_WAITOK); - if (ia == 0) - return (ENOBUFS); bzero((caddr_t)ia, sizeof(*ia)); TAILQ_INSERT_TAIL(&ns_ifaddr, ia, ia_list); TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 2cb8603f19d..34423923334 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: device_pager.c,v 1.5 1997/11/10 09:09:49 niklas Exp $ */ +/* $OpenBSD: device_pager.c,v 1.6 2001/05/16 12:54:34 ho Exp $ */ /* $NetBSD: device_pager.c,v 1.24 1997/01/03 18:03:14 mrg Exp $ */ /* @@ -165,13 +165,7 @@ top: * Allocate and initialize pager structs */ pager = (vm_pager_t)malloc(sizeof *pager, M_VMPAGER, M_WAITOK); - if (pager == NULL) - return(NULL); devp = (dev_pager_t)malloc(sizeof *devp, M_VMPGDATA, M_WAITOK); - if (devp == NULL) { - free((caddr_t)pager, M_VMPAGER); - return(NULL); - } pager->pg_handle = handle; pager->pg_ops = &devicepagerops; pager->pg_type = PG_DEVICE; diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index cc315240115..d3dac7a832a 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_map.c,v 1.19 2001/04/06 23:41:02 art Exp $ */ +/* $OpenBSD: vm_map.c,v 1.20 2001/05/16 12:54:34 ho Exp $ */ /* $NetBSD: vm_map.c,v 1.23 1996/02/10 00:08:08 christos Exp $ */ /* @@ -378,8 +378,6 @@ vm_map_entry_create(map) } else { MALLOC(entry, vm_map_entry_t, sizeof(struct vm_map_entry), M_VMMAPENT, M_WAITOK); - if (entry == NULL) - panic("vm_map_entry_create: couldn't alloc pageable map entry"); } } else { s = splimp(); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 3179af43f71..d1c885fb65c 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode_pager.c,v 1.7 1997/12/10 02:36:54 csapuntz Exp $ */ +/* $OpenBSD: vnode_pager.c,v 1.8 2001/05/16 12:54:34 ho Exp $ */ /* $NetBSD: vnode_pager.c,v 1.19 1996/03/16 23:15:27 christos Exp $ */ /* @@ -148,13 +148,7 @@ vnode_pager_alloc(handle, size, prot, foff) * Allocate pager structures */ pager = (vm_pager_t)malloc(sizeof *pager, M_VMPAGER, M_WAITOK); - if (pager == NULL) - return(NULL); vnp = (vn_pager_t)malloc(sizeof *vnp, M_VMPGDATA, M_WAITOK); - if (vnp == NULL) { - free((caddr_t)pager, M_VMPAGER); - return(NULL); - } /* * And an object of the appropriate size */ |