Skip to content

Commit

Permalink
ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()
Browse files Browse the repository at this point in the history
The "entry" pointer is always non-NULL so this test for out of bounds
won't work.

Fixes: f1f0f33 ("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>
  • Loading branch information
Dan Carpenter authored and tiwai committed May 18, 2018
1 parent ed14d9a commit ed1812c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sound/firewire/dice/dice-tcelectronic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ed1812c

Please sign in to comment.