summaryrefslogtreecommitdiff
path: root/sys/dev/isa/pcppi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/isa/pcppi.c')
-rw-r--r--sys/dev/isa/pcppi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/isa/pcppi.c b/sys/dev/isa/pcppi.c
index 16e2f2cf0cf..46faf991290 100644
--- a/sys/dev/isa/pcppi.c
+++ b/sys/dev/isa/pcppi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcppi.c,v 1.13 2016/01/08 15:54:13 jcs Exp $ */
+/* $OpenBSD: pcppi.c,v 1.14 2019/02/20 07:00:31 anton Exp $ */
/* $NetBSD: pcppi.c,v 1.1 1998/04/15 20:26:18 drochner Exp $ */
/*
@@ -192,6 +192,16 @@ pcppi_bell(self, pitch, period, slp)
struct pcppi_softc *sc = self;
int s1, s2;
+ if (pitch < 0)
+ pitch = 0;
+ else if (pitch > INT_MAX - TIMER_FREQ)
+ pitch = INT_MAX - TIMER_FREQ;
+
+ if (period < 0)
+ period = 0;
+ else if (period > INT_MAX / 1000000)
+ period = INT_MAX / 1000000;
+
s1 = spltty(); /* ??? */
if (sc->sc_bellactive) {
if (sc->sc_timeout) {