Skip to contentSkip to conversation

Fix NULL dereference in OSS v_midi driver

PATCH In review Dave Jones 2 participants 3 messages Sep 1, 2004 – Sep 8, 2004 Sound

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

PATCH 1/1 Fix NULL dereference in OSS v_midi driver

Spotted with the source checker from Coverity.com.

sound/oss/v_midi.c +3 -2
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/v_midi.c linux-2.6/sound/oss/v_midi.c
@@ -90,11 +90,12 @@ static void v_midi_close (int dev)
 static int v_midi_out (int dev, unsigned char midi_byte)
 {
 	vmidi_devc *devc = midi_devs[dev]->devc;
-	vmidi_devc *pdevc = midi_devs[devc->pair_mididev]->devc;
+	vmidi_devc *pdevc;
 
 	if (devc == NULL)
-		return -(ENXIO);
+		return -ENXIO;
 
+	pdevc = midi_devs[devc->pair_mididev]->devc;
 	if (pdevc->input_opened > 0){
 		if (MIDIbuf_avail(pdevc->my_mididev) > 500)
 			return 0;
#1 lore raw
Quoted 1 line · Dave Jones

Spotted with the source checker from Coverity.com.

apologies for the OT question:

how do you get the code checked with the source code checker from Coverity.com?

and would it be possible to have other kernel branches or specific kernel patches checked too?

TIA,
Herbert

author
#2 lore raw
Quoted 7 lines · Herbert Poetzl
Quoted 1 line · Dave Jones

Spotted with the source checker from Coverity.com.

apologies for the OT question:

how do you get the code checked with the source code checker from Coverity.com?

AFAIK, the current results are run on a vanilla 2.6.4 tree.

Quoted 2 lines

and would it be possible to have other kernel branches or specific kernel patches checked too?

I've asked them if they'd rerun the tests on something more recent a few times, but they've other more important things to do it seems.

Dave