ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()
Subsystems (3)
PATCH 1/1 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 <[email protected]>
sound/firewire/dice/dice-tcelectronic.c +1 -2
@@ -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,
Hi,
Quoted 15 lines · Dan Carpenter
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 <[email protected]>sound/firewire/dice/dice-tcelectronic.c +0
-1@@ -75,13 +75,12 @@ int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice) } } - entry =NULL ;
sound/firewire/dice/dice-tcelectronic.c int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice) · line 86
Quoted 10 lines
sound/firewire/dice/dice-tcelectronic.c +1
-1for (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,
Oops, indeed.
Reviewed-by Takashi Sakamoto <[email protected]>
Thanks
Takashi Sakamoto
Takashi Iwai
AppliedQuoted 6 lines · Dan Carpenter
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 <[email protected]>
Applied, thanks.
Takashi