diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-11 11:15:53 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-11 11:15:53 +0000 |
commit | 8fb6c9c872ade860cc3b82074cd425323911ea3f (patch) | |
tree | f500fd530432c359409a0bf8cf1833b46eae0bad | |
parent | dc5af49f3846893a508a263178bfb1477cf04f06 (diff) |
Coverty complains that the return value of sblock() is not checked
in sorflush(), but in other places it is. See CID 1453099. The
flags SB_NOINTR and M_WAITOK should avoid failure. Put an assert
there to be sure.
OK visa@ mpi@
-rw-r--r-- | sys/kern/uipc_socket.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index a54338e28a7..1e5fa38b345 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.203 2017/09/01 15:05:31 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.204 2017/09/11 11:15:52 bluhm Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1041,9 +1041,12 @@ sorflush(struct socket *so) struct sockbuf *sb = &so->so_rcv; struct protosw *pr = so->so_proto; struct socket aso; + int error; sb->sb_flags |= SB_NOINTR; - sblock(so, sb, M_WAITOK); + error = sblock(so, sb, M_WAITOK); + /* with SB_NOINTR and M_WAITOK sblock() must not fail */ + KASSERT(error == 0); socantrcvmore(so); sbunlock(sb); aso.so_proto = pr; |