lkml.org 
[lkml]   [1996]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Newsgroups: linux.dev.kernel
Path: jmorriso
From: jmorriso@bogomips.com (John Paul Morrison)
Subject: divide by zero error in kernel
Organization: BogoMIPS Research Labs
Message-ID: <1996May11.201131.14644@bogomips.com>
Date: Sat, 11 May 1996 20:11:31 GMT


I found a place where the kernel divides by zero - this prints some
messy notices in the logs but does not panic or hanf the system

this patch shows where the bug is, and prevents the divide by zero,
but it should really be fixed some other way. I think a zero argument
is supposed to be handled specially, but I'm not familiar with the code.

I uncovered this problem with a program that generates simple PC
speaker sounds using console ioctls. The program works fine in Linux
1.2.13, so something must have changed in the 1.3 console ioctl argument
handling.

(patch relative to 1.3.98)

--- linux/drivers/char/vt.c.old Fri May 3 22:52:43 1996
+++ linux/drivers/char/vt.c Sat May 11 13:01:35 1996
@@ -236,6 +236,7 @@
* If the time is zero, turn off sound ourselves.
*/
ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
+ if (arg & 0xffff == 0 ) arg |= 1; /* jp: huh? */
count = ticks ? (1193180 / (arg & 0xffff)) : 0;
kd_mksound(count, ticks);
return 0;
--
---------------------------------------------------------------------------
BogoMIPS Research Labs -- bogosity research & simulation -- VE7JPM --
jmorriso@bogomips.com ve7jpm@ve7jpm.ampr.org jmorriso@ve7ubc.ampr.org
---------------------------------------------------------------------------

\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.047 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site