svn commit: r241413 - head/sys/kern
Alexander Motin
mav at FreeBSD.org
Wed Oct 10 19:46:47 UTC 2012
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)
More information about the svn-src-head
mailing list