[PATCH] Fix NULL dereference in OSS v_midi driver

From: Dave Jones
Date: Wed Sep 01 2004 - 12:33:00 EST


Spotted with the source checker from Coverity.com.

Signed-off-by: Dave Jones <davej@xxxxxxxxxx>


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/v_midi.c linux-2.6/sound/oss/v_midi.c
--- bk-linus/sound/oss/v_midi.c 2004-06-03 13:40:31.000000000 +0100
+++ linux-2.6/sound/oss/v_midi.c 2004-06-03 13:43:00.000000000 +0100
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/