NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/51717: audioattach erroneously fails due to uninitialized variable



>Number:         51717
>Category:       kern
>Synopsis:       audioattach erroneously fails due to uninitialized variable
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 14 19:05:00 +0000 2016
>Originator:     Felix Deichmann
>Release:        7.99.46
>Organization:
>Environment:
NetBSD 7.99.46 vax
>Description:
audioattach() in src/sys/dev/audio.c erroneously fails due to uninitialized variable "error".
audio.c r1.268 was still fine, where error = audio_set_defaults(), line 493.
audio.c r1.269 replaced audio_set_defaults() with audio_set_vchan_defaults(), but now misses above assignment, line 609.

dmesg:

NetBSD 7.99.46 (LANCE_TC) #1: Wed Dec 14 18:12:10 CET 2016
	felix%v01nbc02.home@localhost:/nb/obj/sys/arch/vax/compile/LANCE_TC
VAXstation 4000/60
total memory = 81500 KB
avail memory = 74388 KB
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
mainbus0 (root)
cpu0 at mainbus0: KA46, Mariah, 2KB L1 cache, 256KB L2 cache
vsbus0 at mainbus0
vsbus0: 32K entry DMA SGMAP at PA 0x700000 (VA 0x80700000)
vsbus0: interrupt mask 0
le0 at vsbus0 csr 0x200e0000 vec 770 ipl 17 maskbit 1 buf 0x0-0xffff
le0: address 08:00:2b:xx:xx:xx
le0: 32 receive buffers, 8 transmit buffers
dz0 at vsbus0 csr 0x200a0000 vec 124 ipl 17 maskbit 4
dz0: 4 lines
lkkbd0 at dz0
lkkbd0: no keyboard
wskbd0 at lkkbd0 mux 1
lkms0 at dz0
wsmouse0 at lkms0 mux 0
tc0 at vsbus0 csr 0x36800000 vec 764 ipl 17 maskbit -1: 12.5 MHz clock
le1 at tc0 slot 0 offset 0x0: address 08:00:2b:xx:xx:xx
le1: 32 receive buffers, 8 transmit buffers
asc0 at vsbus0 csr 0x200c0080 vec 774 ipl 17 maskbit 0
asc0: NCR53C94, 25MHz, SCSI ID 7
scsibus0 at asc0: 8 targets, 8 luns per target
lcg0 at vsbus0 csr 0x21801000 vec 440 ipl 15 maskbit 2
lcg0: framebuffer size 1280x1024, depth 8 (magic 0x90)
lcg0: using font QVSS (8x15), console size: 160x68
wsdisplay0 at lcg0 kbdmux 1
wsmux1: connecting to wsdisplay0
wskbd0: connecting to wsdisplay0
wsdisplay0: screen 0-7 added (160x68, vt100 emulation)
vsaudio0 at vsbus0 csr 0x200d0000 vec 304 ipl 17 maskbit 6
audio0 at vsaudio0: full duplex, playback, capture
audioattach: audio_set_vchan_defaults() failed

*** Possible fix is attached. ***
>How-To-Repeat:
Boot on a machine where "error" is not set in audioattach(), at least not at the moment, like VAXstation 4000 or DEC 3000 (?).
>Fix:
Index: src/sys/dev/audio.c
===================================================================
RCS file: /cvsroot/src/sys/dev/audio.c,v
retrieving revision 1.278
diff -u -p -r1.278 audio.c
--- src/sys/dev/audio.c	13 Dec 2016 17:12:51 -0000	1.278
+++ src/sys/dev/audio.c	14 Dec 2016 16:42:06 -0000
@@ -605,11 +605,12 @@ bad_rec:
 	sc->sc_lastgain = 128;
 	sc->sc_saturate = true;
 
-	audio_set_vchan_defaults(sc, AUMODE_PLAY | AUMODE_PLAY_ALL |
+	error = audio_set_vchan_defaults(sc, AUMODE_PLAY | AUMODE_PLAY_ALL |
 	    AUMODE_RECORD, &vaudio_formats[0], 0);
 	mutex_exit(sc->sc_lock);
 	if (error != 0) {
-		aprint_error("audioattach: audio_set_defaults() failed\n");
+		aprint_error("audioattach: audio_set_vchan_defaults() "
+		    "failed\n");
 		sc->hw_if = NULL;
 		return;
 	}



Home | Main Index | Thread Index | Old Index