Commit 9090e6db authored by Clemens Ladisch's avatar Clemens Ladisch Committed by 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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment