1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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)
This commit is contained in:
Robert Watson 2011-08-19 08:29:10 +00:00
parent b465884f42
commit 311fa10b52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224999

View File

@ -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"));
}