summaryrefslogtreecommitdiffstats
path: root/sound/firewire/dice
diff options
context:
space:
mode:
authorDan Carpenter2018-05-18 11:16:07 +0200
committerTakashi Iwai2018-05-18 13:38:34 +0200
commited1812c44cdc04fc56c5e7f7fdcd31941ffce58d (patch)
treed97900b103f91449c6f68b6de7321364235ffee2 /sound/firewire/dice
parentMerge branch 'topic/timer-fixes' into for-next (diff)
downloadkernel-qcow2-linux-ed1812c44cdc04fc56c5e7f7fdcd31941ffce58d.tar.gz
kernel-qcow2-linux-ed1812c44cdc04fc56c5e7f7fdcd31941ffce58d.tar.xz
kernel-qcow2-linux-ed1812c44cdc04fc56c5e7f7fdcd31941ffce58d.zip
ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()
The "entry" pointer is always non-NULL so this test for out of bounds won't work. Fixes: f1f0f330b1d0 ("ALSA: dice: add parameters of stream formats for models produced by TC Electronic") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/dice')
-rw-r--r--sound/firewire/dice/dice-tcelectronic.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/firewire/dice/dice-tcelectronic.c b/sound/firewire/dice/dice-tcelectronic.c
index af8203b9d1a6..e134a5110c6c 100644
--- a/sound/firewire/dice/dice-tcelectronic.c
+++ b/sound/firewire/dice/dice-tcelectronic.c
@@ -75,13 +75,12 @@ int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice)
}
}
- entry = NULL;
for (i = 0; i < ARRAY_SIZE(entries); ++i) {
entry = entries + i;
if (entry->model_id == model_id)
break;
}
- if (!entry)
+ if (i == ARRAY_SIZE(entries))
return -ENODEV;
memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,