diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2016-06-27 21:44:27 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2016-06-27 21:44:27 +0000 |
commit | 46cba9192e970d80d556791991862b19bea90ea2 (patch) | |
tree | e219d7b0b673d1ab0c59d802295815d4dff937f4 | |
parent | 039c648cc1096a798918c59ba356afa274b0c3b4 (diff) | |
download | FreeBSD-src-46cba9192e970d80d556791991862b19bea90ea2.zip FreeBSD-src-46cba9192e970d80d556791991862b19bea90ea2.tar.gz |
MFC r297391:
Remove some NULL checks for M_WAITOK allocations.
-rw-r--r-- | sys/kern/imgact_elf.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_linker.c | 2 | ||||
-rw-r--r-- | sys/net/rtsock.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 2 | ||||
-rw-r--r-- | sys/rpc/rpc_generic.c | 8 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_extattr.c | 2 |
7 files changed, 0 insertions, 24 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index e3c08de..1e237c2 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1325,10 +1325,6 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) * and write it out following the notes. */ hdr = malloc(hdrsize, M_TEMP, M_WAITOK); - if (hdr == NULL) { - error = EINVAL; - goto done; - } error = __elfN(corehdr)(td, vp, cred, seginfo.count, hdr, hdrsize, ¬elst, notesz, gzfile); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6ccfaa3..d274ff3 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1498,8 +1498,6 @@ exec_register(execsw_arg) for (es = execsw; *es; es++) count++; newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); - if (newexecsw == NULL) - return (ENOMEM); xs = newexecsw; if (execsw) for (es = execsw; *es; es++) @@ -1532,8 +1530,6 @@ exec_unregister(execsw_arg) if (*es != execsw_arg) count++; newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); - if (newexecsw == NULL) - return (ENOMEM); xs = newexecsw; for (es = execsw; *es; es++) if (*es != execsw_arg) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 78eab87..757837b 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1762,8 +1762,6 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname, goto bad; } hints = malloc(vattr.va_size, M_TEMP, M_WAITOK); - if (hints == NULL) - goto bad; error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)hints, vattr.va_size, 0, UIO_SYSSPACE, IO_NODELOCKED, cred, NOCRED, &reclen, td); if (error) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 1979ea0..cdabb3e 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -301,8 +301,6 @@ rts_attach(struct socket *so, int proto, struct thread *td) /* XXX */ rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO); - if (rp == NULL) - return ENOBUFS; so->so_pcb = (caddr_t)rp; so->so_fibnum = td->td_proc->p_fibnum; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 9fe6eac..8afb05f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1285,8 +1285,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) return (error); inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - if (inp_list == NULL) - return (ENOMEM); INP_INFO_RLOCK(&V_tcbinfo); for (inp = LIST_FIRST(V_tcbinfo.ipi_listhead), i = 0; diff --git a/sys/rpc/rpc_generic.c b/sys/rpc/rpc_generic.c index 28aa849..80d658d 100644 --- a/sys/rpc/rpc_generic.c +++ b/sys/rpc/rpc_generic.c @@ -390,15 +390,11 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) } ret = (struct netbuf *)malloc(sizeof *ret, M_RPC, M_WAITOK); - if (ret == NULL) - goto out; switch (af) { case AF_INET: sin = (struct sockaddr_in *)malloc(sizeof *sin, M_RPC, M_WAITOK); - if (sin == NULL) - goto out; memset(sin, 0, sizeof *sin); sin->sin_family = AF_INET; sin->sin_port = htons(port); @@ -415,8 +411,6 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) case AF_INET6: sin6 = (struct sockaddr_in6 *)malloc(sizeof *sin6, M_RPC, M_WAITOK); - if (sin6 == NULL) - goto out; memset(sin6, 0, sizeof *sin6); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); @@ -433,8 +427,6 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) case AF_LOCAL: sun = (struct sockaddr_un *)malloc(sizeof *sun, M_RPC, M_WAITOK); - if (sun == NULL) - goto out; memset(sun, 0, sizeof *sun); sun->sun_family = AF_LOCAL; strncpy(sun->sun_path, addrstr, sizeof(sun->sun_path) - 1); diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c index 2313d68..d01320a 100644 --- a/sys/ufs/ufs/ufs_extattr.c +++ b/sys/ufs/ufs/ufs_extattr.c @@ -599,8 +599,6 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace, attribute = malloc(sizeof(struct ufs_extattr_list_entry), M_UFS_EXTATTR, M_WAITOK); - if (attribute == NULL) - return (ENOMEM); if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_STARTED)) { error = EOPNOTSUPP; |