Module Name:    src
Committed By:   maya
Date:           Tue Apr 18 15:14:28 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: pmc.c

Log Message:
switch pmc_ncounters to unsigned int.

matches userland pmc, makes it clear to static analyzers that if the loop
in pmc_nmi (for (i = 0; i < pmc_ncounters; i++) ) is not entered, then the
condition i == pmc_ncounters (== 0) is satisfied and no null derefs occur

this change only helps analyzers read the code, null deref was not possible
before.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/pmc.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/arch/x86/x86/pmc.c
diff -u src/sys/arch/x86/x86/pmc.c:1.5 src/sys/arch/x86/x86/pmc.c:1.6
--- src/sys/arch/x86/x86/pmc.c:1.5	Fri Mar 24 19:21:06 2017
+++ src/sys/arch/x86/x86/pmc.c	Tue Apr 18 15:14:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.5 2017/03/24 19:21:06 maxv Exp $	*/
+/*	$NetBSD: pmc.c,v 1.6 2017/04/18 15:14:28 maya Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.5 2017/03/24 19:21:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.6 2017/04/18 15:14:28 maya Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,7 +106,7 @@ static x86_pmc_cpuval_t pmc_val_cpus[MAX
 static kmutex_t pmc_lock;
 
 static pmc_state_t pmc_state[PMC_NCOUNTERS];
-static int pmc_ncounters __read_mostly;
+static uint32_t pmc_ncounters __read_mostly;
 static int pmc_type __read_mostly;
 
 static int

Reply via email to