Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern tc_init(): KASSERT that the timecounter hasn't prev...
details: https://anonhg.NetBSD.org/src/rev/a615e9290d13
branches: trunk
changeset: 982288:a615e9290d13
user: simonb <simonb%NetBSD.org@localhost>
date: Thu Apr 08 06:06:24 2021 +0000
description:
tc_init(): KASSERT that the timecounter hasn't previously been
initialised by checking the tc_next field. Prevents nastly endless
loops in the timecounter code.
diffstat:
sys/kern/kern_tc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 57275d419565 -r a615e9290d13 sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c Wed Apr 07 20:32:54 2021 +0000
+++ b/sys/kern/kern_tc.c Thu Apr 08 06:06:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $ */
+/* $NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -551,6 +551,9 @@
{
u_int u;
+ KASSERTMSG(tc->tc_next == NULL, "timecounter %s already initialised",
+ tc->tc_name);
+
u = tc->tc_frequency / tc->tc_counter_mask;
/* XXX: We need some margin here, 10% is a guess */
u *= 11;
Home |
Main Index |
Thread Index |
Old Index