Author: rwatson
Date: Fri Aug 19 08:29:10 2011
New Revision: 224999
URL: http://svn.freebsd.org/changeset/base/224999

Log:
  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)

Modified:
  head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==============================================================================
--- head/sys/kern/subr_sbuf.c   Fri Aug 19 07:21:19 2011        (r224998)
+++ head/sys/kern/subr_sbuf.c   Fri Aug 19 08:29:10 2011        (r224999)
@@ -184,7 +184,7 @@ sbuf_newbuf(struct sbuf *s, char *buf, i
        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"));
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to