Bug 138557

Summary: [patch] fix truncated witness sysctl string due to incorrect use of sizeof
Product: Base System Reporter: Rebecca Cran <bcran>
Component: kernAssignee: Antoine Brodin <antoine>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.0-BETA3   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Rebecca Cran freebsd_committer freebsd_triage 2009-09-05 22:00:13 UTC
In sys/kern/subr_witness.c the strings "Witness not running" and "Witness is still cold" get truncated to "Witn" in the sysctl tree because sizeof is used instead of strlen.

Fix: Patch attached with submission follows:
How-To-Repeat: sysctl debug.witness.watch=0
sysctl debug.witness.badstacks
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2009-09-06 13:48:52 UTC
Responsible Changed
From-To: freebsd-bugs->antoine

Take.
Comment 2 dfilter service freebsd_committer freebsd_triage 2009-09-06 14:31:19 UTC
Author: antoine
Date: Sun Sep  6 13:31:05 2009
New Revision: 196891
URL: http://svn.freebsd.org/changeset/base/196891

Log:
  Change w_notrunning and w_stillcold from pointer to array so that sizeof
  returns what is expected.
  
  PR:		kern/138557
  Discussed with:	brucec@
  MFC after:	1 month

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Sun Sep  6 13:26:51 2009	(r196890)
+++ head/sys/kern/subr_witness.c	Sun Sep  6 13:31:05 2009	(r196891)
@@ -469,8 +469,8 @@ static struct witness_lock_order_data *w
 static struct witness_lock_order_hash w_lohash;
 static int w_max_used_index = 0;
 static unsigned int w_generation = 0;
-static const char *w_notrunning = "Witness not running\n";
-static const char *w_stillcold = "Witness is still cold\n";
+static const char w_notrunning[] = "Witness not running\n";
+static const char w_stillcold[] = "Witness is still cold\n";
 
 
 static struct witness_order_list_entry order_lists[] = {
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2009-09-06 14:36:03 UTC
State Changed
From-To: open->patched

Fixed in head.
Comment 4 dfilter service freebsd_committer freebsd_triage 2009-10-31 12:26:56 UTC
Author: antoine
Date: Sat Oct 31 12:26:40 2009
New Revision: 198715
URL: http://svn.freebsd.org/changeset/base/198715

Log:
  MFC r196891 to stable/8:
    Change w_notrunning and w_stillcold from pointer to array so that sizeof
    returns what is expected.
  
    PR:		kern/138557
    Discussed with:	brucec@
    MFC after:	1 month

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/subr_witness.c

Modified: stable/8/sys/kern/subr_witness.c
==============================================================================
--- stable/8/sys/kern/subr_witness.c	Sat Oct 31 12:22:23 2009	(r198714)
+++ stable/8/sys/kern/subr_witness.c	Sat Oct 31 12:26:40 2009	(r198715)
@@ -469,8 +469,8 @@ static struct witness_lock_order_data *w
 static struct witness_lock_order_hash w_lohash;
 static int w_max_used_index = 0;
 static unsigned int w_generation = 0;
-static const char *w_notrunning = "Witness not running\n";
-static const char *w_stillcold = "Witness is still cold\n";
+static const char w_notrunning[] = "Witness not running\n";
+static const char w_stillcold[] = "Witness is still cold\n";
 
 
 static struct witness_order_list_entry order_lists[] = {
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2009-10-31 12:32:14 UTC
State Changed
From-To: patched->closed

Fixed in stable/8 too.