From 8a809862547bc0df5fd4de8d8ee9e30bb3ea89ae Mon Sep 17 00:00:00 2001 From: Dan Rosenberg Date: Wed, 23 Mar 2011 11:42:57 -0400 Subject: [PATCH] --- yaml --- r: 242957 b: refs/heads/master c: 4d00135a680727f6c3be78f8befaac009030e4df h: refs/heads/master i: 242955: 7a330844d60aef093df04712c669ab6bd969ef09 v: v3 --- [refs] | 2 +- trunk/sound/oss/opl3.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 7efc01724ee3..2db25c6d5416 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b769f49463711205d57286e64cf535ed4daf59e9 +refs/heads/master: 4d00135a680727f6c3be78f8befaac009030e4df diff --git a/trunk/sound/oss/opl3.c b/trunk/sound/oss/opl3.c index cbf957424d5c..407cd677950b 100644 --- a/trunk/sound/oss/opl3.c +++ b/trunk/sound/oss/opl3.c @@ -845,6 +845,10 @@ static int opl3_load_patch(int dev, int format, const char __user *addr, static void opl3_panning(int dev, int voice, int value) { + + if (voice < 0 || voice >= devc->nr_voice) + return; + devc->voc[voice].panning = value; } @@ -1062,8 +1066,15 @@ static int opl3_alloc_voice(int dev, int chn, int note, struct voice_alloc_info static void opl3_setup_voice(int dev, int voice, int chn) { - struct channel_info *info = - &synth_devs[dev]->chn_info[chn]; + struct channel_info *info; + + if (voice < 0 || voice >= devc->nr_voice) + return; + + if (chn < 0 || chn > 15) + return; + + info = &synth_devs[dev]->chn_info[chn]; opl3_set_instr(dev, voice, info->pgm_num);