diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-15 19:29:29 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-15 19:29:29 +0000 |
commit | d866e3a014e7c2d407873e122ad6c8b9c418295c (patch) | |
tree | a5a51dbe29e58314a2595feffde8d3b565695e48 /sys/kern | |
parent | 8e41634d9bce4aae038f4599ef8076211bbcc737 (diff) |
Coverity complains that top == NULL was checked and further down
top->m_pkthdr.len was accessed without check. See CID 1452933.
In fact top cannot be NULL there and the condition was always false.
m_getuio() did never reserve space for the header. The correct
check is m == top to find the first mbuf.
OK visa@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_socket.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1e5fa38b345..615da029414 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.204 2017/09/11 11:15:52 bluhm Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.205 2017/09/15 19:29:28 bluhm Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -540,7 +540,7 @@ m_getuio(struct mbuf **mp, int atomic, long space, struct uio *uio) * For datagram protocols, leave room * for protocol headers in first mbuf. */ - if (atomic && top == NULL && len < mlen - max_hdr) + if (atomic && m == top && len < mlen - max_hdr) m->m_data += max_hdr; } else { nopages: @@ -549,7 +549,7 @@ nopages: * For datagram protocols, leave room * for protocol headers in first mbuf. */ - if (atomic && top == NULL && len < mlen - max_hdr) + if (atomic && m == top && len < mlen - max_hdr) MH_ALIGN(m, len); } |