From: Clemens Ladisch 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: Clemens Ladisch Signed-off-by: Andrew Morton --- drivers/char/hpet.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) diff -puN drivers/char/hpet.c~hpet-disallow-zero-interrupt-frequency drivers/char/hpet.c --- devel/drivers/char/hpet.c~hpet-disallow-zero-interrupt-frequency 2005-09-28 22:49:35.000000000 -0700 +++ devel-akpm/drivers/char/hpet.c 2005-09-28 22:49:35.000000000 -0700 @@ -364,6 +364,9 @@ static int hpet_ioctl_ieon(struct hpet_d 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, break; } - if (arg & (arg - 1)) { + if (!arg || (arg & (arg - 1))) { err = -EINVAL; break; } _