1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

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
This commit is contained in:
Alexander Motin 2012-10-10 19:46:46 +00:00
parent 0b8ce217a8
commit 803a9b3efd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241413

View File

@ -602,7 +602,8 @@ round_freq(struct eventtimer *et, int freq)
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)