Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2011 08:29:10 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224999 - head/sys/kern
Message-ID:  <201108190829.p7J8TAVd094406@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"));
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108190829.p7J8TAVd094406>