aboutsummaryrefslogtreecommitdiff
path: root/sound/drivers/opl3/opl3_synth.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-05-22 10:28:38 +0100
committerMark Brown <broonie@kernel.org>2018-05-22 10:28:38 +0100
commite1c51aa8705fd78e5259e0515aad3b5003e18550 (patch)
tree3728628142a24460d6b488e5331f421f902e5d3a /sound/drivers/opl3/opl3_synth.c
parent6e49b7fa3083c30688b7fff1b37ed891cd1c30af (diff)
parent08556e03ad36b2c6219aba90de88ccf58038e208 (diff)
Merge branch 'linux-linaro-lsk-v4.9' into linux-linaro-lsk-v4.9-rtlinux-linaro-lsk-v4.9-rt-test
Diffstat (limited to 'sound/drivers/opl3/opl3_synth.c')
-rw-r--r--sound/drivers/opl3/opl3_synth.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c
index ddcc1a325a61..42920a243328 100644
--- a/sound/drivers/opl3/opl3_synth.c
+++ b/sound/drivers/opl3/opl3_synth.c
@@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <linux/export.h>
+#include <linux/nospec.h>
#include <sound/opl3.h>
#include <sound/asound_fm.h>
@@ -448,7 +449,7 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v
{
unsigned short reg_side;
unsigned char op_offset;
- unsigned char voice_offset;
+ unsigned char voice_offset, voice_op;
unsigned short opl3_reg;
unsigned char reg_val;
@@ -473,7 +474,9 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v
voice_offset = voice->voice - MAX_OPL2_VOICES;
}
/* Get register offset of operator */
- op_offset = snd_opl3_regmap[voice_offset][voice->op];
+ voice_offset = array_index_nospec(voice_offset, MAX_OPL2_VOICES);
+ voice_op = array_index_nospec(voice->op, 4);
+ op_offset = snd_opl3_regmap[voice_offset][voice_op];
reg_val = 0x00;
/* Set amplitude modulation (tremolo) effect */