Subject: port-i386/2295: Bug in spkr.c
To: None <gnats-bugs@NetBSD.ORG>
From: SAITOH Masanobu <msaitoh@spa.is.uec.ac.jp>
List: netbsd-bugs
Date: 04/04/1996 06:12:52
>Number:         2295
>Category:       port-i386
>Synopsis:       Bug in spkr.c
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr  3 16:50:01 1996
>Last-Modified:
>Originator:     SAITOH Masanobu
>Organization:
University of Electro-Communications
>Release:        latest -current
>Environment:
System: NetBSD vfault.spa.is.uec.ac.jp 1.1B NetBSD 1.1B (VFAULT) #21: Wed Apr 3 22:56:58 JST 1996 hikaru@vfault.spa.is.uec.ac.jp:/var/current/src/sys/arch/i386/compile/VFAULT i386


>Description:
	Octave calculation in spkr.c has bugs.

>How-To-Repeat:

	If you execute following command, it makes kernel panic.

		% echo c\>c\>c\>c\>c >/dev/speaker

>Fix:
	Apply following patch:

--- spkr.c.org	Mon Mar 18 21:26:50 1996
+++ spkr.c	Thu Apr  4 05:29:49 1996
@@ -330,14 +330,14 @@
 	    else
 	    {
 		GETNUM(cp, octave);
-		if (octave >= sizeof(pitchtab) / OCTAVE_NOTES)
+		if (octave >= sizeof(pitchtab) / OCTAVE_NOTES / sizeof(int))
 		    octave = DFLT_OCTAVE;
 		octprefix = TRUE;
 	    }
 	    break;
 
 	case '>':
-	    if (octave < sizeof(pitchtab) / OCTAVE_NOTES - 1)
+	    if (octave < (sizeof(pitchtab) / OCTAVE_NOTES / sizeof(int)) - 1)
 		octave++;
 	    octprefix = TRUE;
 	    break;
>Audit-Trail:
>Unformatted: