summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_sbuf.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2011-08-19 08:29:10 +0000
committerrwatson <rwatson@FreeBSD.org>2011-08-19 08:29:10 +0000
commitb8fd2dd0fde3a036af67a6ffd6ddbc2755167116 (patch)
treeb3014bfb0277a242f487b799d034bf51063a3d9a /sys/kern/subr_sbuf.c
parent14454847f17719e23a6acb72a60bc5fd71ff35b2 (diff)
downloadFreeBSD-src-b8fd2dd0fde3a036af67a6ffd6ddbc2755167116.zip
FreeBSD-src-b8fd2dd0fde3a036af67a6ffd6ddbc2755167116.tar.gz
r222015 introduced a new assertion that the size of a fixed-length sbuf
buffer is greater than 1. This triggered panics in at least one spot in the kernel (the MAC Framework) which passes non-negative, rather than >1 buffer sizes based on the size of a user buffer passed into a system call. While 0-size buffers aren't particularly useful, they also aren't strictly incorrect, so loosen the assertion. Discussed with: phk (fears I might be EDOOFUS but willing to go along) Spotted by: pho + stress2 Approved by: re (kib)
Diffstat (limited to 'sys/kern/subr_sbuf.c')
-rw-r--r--sys/kern/subr_sbuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index e931e65..c0d7ea0 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -184,7 +184,7 @@ sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags)
s->s_buf = buf;
if ((s->s_flags & SBUF_AUTOEXTEND) == 0) {
- KASSERT(s->s_size > 1,
+ KASSERT(s->s_size >= 0,
("attempt to create a too small sbuf"));
}
OpenPOWER on IntegriCloud