[PATCH 3/7] HPET: fix division by zero in HPET_INFO

From: Clemens Ladisch
Date: Tue Oct 04 2005 - 07:43:43 EST


From: Clemens Ladisch <clemens@xxxxxxxxxx>

Fix a division by zero that happened when the HPET_INFO ioctl was
called before a timer frequency had been set.

Signed-off-by: Clemens Ladisch <clemens@xxxxxxxxxx>

Index: linux-2.6.13/drivers/char/hpet.c
===================================================================
--- linux-2.6.13.orig/drivers/char/hpet.c 2005-10-03 22:53:12.000000000 +0200
+++ linux-2.6.13/drivers/char/hpet.c 2005-10-03 22:53:15.000000000 +0200
@@ -494,8 +494,11 @@ hpet_ioctl_common(struct hpet_dev *devp,
{
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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/