Module Name:    src
Committed By:   christos
Date:           Fri Sep 16 01:03:02 UTC 2011

Modified Files:
        src/sys/kern: subr_evcnt.c

Log Message:
check that we have valid event strings on attach too, so that the error
is obvious instead of catching it when vmstat -e runs!


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.9 src/sys/kern/subr_evcnt.c:1.10
--- src/sys/kern/subr_evcnt.c:1.9	Sat Jan 29 12:35:24 2011
+++ src/sys/kern/subr_evcnt.c	Thu Sep 15 21:03:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.9 2011/01/29 17:35:24 matt Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.10 2011/09/16 01:03:02 christos Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.9 2011/01/29 17:35:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.10 2011/09/16 01:03:02 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/evcnt.h>
@@ -137,14 +137,14 @@
 
 	len = strlen(ev->ev_group);
 #ifdef DIAGNOSTIC
-	if (len >= EVCNT_STRING_MAX)		/* ..._MAX includes NUL */
+	if (len == 0 || len >= EVCNT_STRING_MAX) /* ..._MAX includes NUL */
 		panic("evcnt_attach_static: group length (%s)", ev->ev_group);
 #endif
 	ev->ev_grouplen = len;
 
 	len = strlen(ev->ev_name);
 #ifdef DIAGNOSTIC
-	if (len >= EVCNT_STRING_MAX)		/* ..._MAX includes NUL */
+	if (len == 0 || len >= EVCNT_STRING_MAX) /* ..._MAX includes NUL */
 		panic("evcnt_attach_static: name length (%s)", ev->ev_name);
 #endif
 	ev->ev_namelen = len;

Reply via email to