From 33fdf819053e42f5592d43ecde891fbbfc4ec79f Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Thu, 2 Sep 2004 00:37:41 -0700 Subject: [PATCH] [PATCH] Fix NULL dereference in OSS v_midi driver Spotted with the source checker from Coverity.com. Signed-off-by: Dave Jones Signed-off-by: Linus Torvalds --- sound/oss/v_midi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/oss/v_midi.c b/sound/oss/v_midi.c index 656c0636685b0..077b767976659 100644 --- a/sound/oss/v_midi.c +++ b/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; -- 2.53.0