Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Dec 2012 22:26:16 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244280 - head/sys/dev/wbwd
Message-ID:  <201212152226.qBFMQHA3048929@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sat Dec 15 22:26:16 2012
New Revision: 244280
URL: http://svnweb.freebsd.org/changeset/base/244280

Log:
  sbuf_trim() cannot be used on sbuf with drain function set.
  This fixes panic when listing sysctls on INVARIANTS-enabled kernel while
  having wbwd loaded.
  
  This panic was not fatal, at worst one additional space was printed.
  
  Also sbuf_trim() makes some sense even if drain function is set. The drain
  function is called only when buffer is to be expanded. So we could still trim
  existing buffer before drain is called. In this case it worked just fine - the
  trailing space was correctly trimmed.
  
  Obtained from:	WHEEL Systems
  MFC after:	1 week

Modified:
  head/sys/dev/wbwd/wbwd.c

Modified: head/sys/dev/wbwd/wbwd.c
==============================================================================
--- head/sys/dev/wbwd/wbwd.c	Sat Dec 15 21:57:34 2012	(r244279)
+++ head/sys/dev/wbwd/wbwd.c	Sat Dec 15 22:26:16 2012	(r244280)
@@ -208,9 +208,8 @@ sysctl_wb_debug(SYSCTL_HANDLER_ARGS)
 	sbuf_printf(&sb, "LDN8 (GPIO2, Watchdog): ");
 	sbuf_printf(&sb, "CRF5 0x%02x ", sc->reg_1);
 	sbuf_printf(&sb, "CRF6 0x%02x ", sc->reg_timeout);
-	sbuf_printf(&sb, "CRF7 0x%02x ", sc->reg_2);
+	sbuf_printf(&sb, "CRF7 0x%02x", sc->reg_2);
 
-	sbuf_trim(&sb);
 	error = sbuf_finish(&sb);
 	sbuf_delete(&sb);
 	return (error);



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