Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern check that we have valid event strings on attach to...



details:   https://anonhg.NetBSD.org/src/rev/8f66cdc1dfc7
branches:  trunk
changeset: 769611:8f66cdc1dfc7
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 16 01:03:02 2011 +0000

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

diffstat:

 sys/kern/subr_evcnt.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r f701a46d83ba -r 8f66cdc1dfc7 sys/kern/subr_evcnt.c
--- a/sys/kern/subr_evcnt.c     Thu Sep 15 20:25:23 2011 +0000
+++ b/sys/kern/subr_evcnt.c     Fri Sep 16 01:03:02 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index