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

[PATCH] hpet: disallow zero interrupt frequency

Disallow setting an interrupt frequency of zero (which would result in a
division by zero), and disallow enabling the interrupt when the frequency
hasn't yet been set (which would use an interrupt period of zero).
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 874ec33f
......@@ -364,6 +364,9 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp)
hpet = devp->hd_hpet;
hpetp = devp->hd_hpets;
if (!devp->hd_ireqfreq)
return -EIO;
v = readq(&timer->hpet_config);
spin_lock_irq(&hpet_lock);
......@@ -516,7 +519,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
break;
}
if (arg & (arg - 1)) {
if (!arg || (arg & (arg - 1))) {
err = -EINVAL;
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册