提交 af95eade 编写于 作者: C Clemens Ladisch 提交者: Linus Torvalds

[PATCH] hpet: fix division by zero in HPET_INFO

Fix a division by zero that happened when the HPET_INFO ioctl was called
before a timer frequency had been set.
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Cc: Bob Picco <bob.picco@hp.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8e8505be
......@@ -494,8 +494,11 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
{
struct hpet_info info;
info.hi_ireqfreq = hpet_time_div(hpetp,
devp->hd_ireqfreq);
if (devp->hd_ireqfreq)
info.hi_ireqfreq =
hpet_time_div(hpetp, devp->hd_ireqfreq);
else
info.hi_ireqfreq = 0;
info.hi_flags =
readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
info.hi_hpet = devp->hd_hpets->hp_which;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册