Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2012 19:46:46 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241413 - head/sys/kern
Message-ID:  <201210101946.q9AJkkvx089025@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Oct 10 19:46:46 2012
New Revision: 241413
URL: http://svn.freebsd.org/changeset/base/241413

Log:
  panic() with reasonable message instead of returning zero frequency causing
  division by zero later if event timer's minimal period is above one second.
  For now it is just a theoretical possibility.
  
  Found by:	Clang Static Analyzer

Modified:
  head/sys/kern/kern_clocksource.c

Modified: head/sys/kern/kern_clocksource.c
==============================================================================
--- head/sys/kern/kern_clocksource.c	Wed Oct 10 19:43:45 2012	(r241412)
+++ head/sys/kern/kern_clocksource.c	Wed Oct 10 19:46:46 2012	(r241413)
@@ -602,7 +602,8 @@ round_freq(struct eventtimer *et, int fr
 		freq = (et->et_frequency + div / 2) / div;
 	}
 	if (et->et_min_period.sec > 0)
-		freq = 0;
+		panic("Event timer \"%s\" doesn't support sub-second periods!",
+		    et->et_name);
 	else if (et->et_min_period.frac != 0)
 		freq = min(freq, BT2FREQ(&et->et_min_period));
 	if (et->et_max_period.sec == 0 && et->et_max_period.frac != 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210101946.q9AJkkvx089025>