summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_sbuf.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2010-09-16 16:13:12 +0000
committermdf <mdf@FreeBSD.org>2010-09-16 16:13:12 +0000
commit5695ef46983ceb88b1862571c052f8da0fac0275 (patch)
treeafd1abc4a36abd5ca015ead87a457fe7f1968ed9 /sys/kern/subr_sbuf.c
parent39642e55302d3d222f5a118fb3a4c6eb91d7e5a0 (diff)
downloadFreeBSD-src-5695ef46983ceb88b1862571c052f8da0fac0275.zip
FreeBSD-src-5695ef46983ceb88b1862571c052f8da0fac0275.tar.gz
Re-add r212370 now that the LOR in powerpc64 has been resolved:
Add a drain function for struct sysctl_req, and use it for a variety of handlers, some of which had to do awkward things to get a large enough SBUF_FIXEDLEN buffer. Note that some sysctl handlers were explicitly outputting a trailing NUL byte. This behaviour was preserved, though it should not be necessary. Reviewed by: phk (original patch)
Diffstat (limited to 'sys/kern/subr_sbuf.c')
-rw-r--r--sys/kern/subr_sbuf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index e81faa5..0d083b4 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -303,8 +303,8 @@ sbuf_drain(struct sbuf *s)
s->s_error = -len;
return (s->s_error);
}
-
- KASSERT(len > 0, ("Drain must either error or work!"));
+ KASSERT(len > 0 && len <= s->s_len,
+ ("Bad drain amount %d for sbuf %p", len, s));
s->s_len -= len;
/*
* Fast path for the expected case where all the data was
OpenPOWER on IntegriCloud