lkml.org 
[lkml]   [2005]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] HPET: disallow zero interrupt frequency
Trying to set an interrupt frequency of zero would result in a
division by zero, so disallow this.

Enabling the interrupt when the frequency hasn't yet been set would
use an interrupt period of minimum length, so disallow this, too.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

--- linux-2.6.13.orig/drivers/char/hpet.c 2005-09-22 10:56:23.000000000 +0200
+++ linux-2.6.13/drivers/char/hpet.c 2005-09-22 10:56:26.000000000 +0200
@@ -365,6 +365,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);

@@ -517,7 +520,7 @@ hpet_ioctl_common(struct hpet_dev *devp,
break;
}

- if (arg & (arg - 1)) {
+ if (arg < 1 || (arg & (arg - 1))) {
err = -EINVAL;
break;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-09-22 17:11    [W:0.060 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site