linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] HPET: disallow zero interrupt frequency
@ 2005-09-22 15:08 Clemens Ladisch
  2005-09-22 15:08 ` [PATCH 2/2] HPET: make frequency calculations 32 bit safe Clemens Ladisch
  2005-09-22 19:14 ` [PATCH 1/2] HPET: disallow zero interrupt frequency Bob Picco
  0 siblings, 2 replies; 6+ messages in thread
From: Clemens Ladisch @ 2005-09-22 15:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Clemens Ladisch, Bob Picco

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;
 		}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-09-30  6:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22 15:08 [PATCH 1/2] HPET: disallow zero interrupt frequency Clemens Ladisch
2005-09-22 15:08 ` [PATCH 2/2] HPET: make frequency calculations 32 bit safe Clemens Ladisch
2005-09-27 14:57   ` Bob Picco
2005-09-30  6:30     ` Clemens Ladisch
2005-09-22 19:14 ` [PATCH 1/2] HPET: disallow zero interrupt frequency Bob Picco
2005-09-28  6:51   ` Clemens Ladisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).