Skip to content

Commit 0ec5258

Browse files
Torsten Schenktiwai
authored andcommitted
ALSA: 6fire - Fix signedness bug
Fixed remaining issues of the signedness bug discovered by Dan Carpenter. A check was remaining that tests if unsigned rt->rate is >= 0. Changed that so that rt->rate now consistently uses ARRAY_SIZE(rates) as invalid rate value and not -1. Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e72888e commit 0ec5258

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/usb/6fire/pcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ static int usb6fire_pcm_open(struct snd_pcm_substream *alsa_sub)
395395
alsa_rt->hw = pcm_hw;
396396

397397
if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
398-
if (rt->rate >= 0)
398+
if (rt->rate < ARRAY_SIZE(rates))
399399
alsa_rt->hw.rates = rates_alsaid[rt->rate];
400400
alsa_rt->hw.channels_max = OUT_N_CHANNELS;
401401
sub = &rt->playback;
402402
} else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) {
403-
if (rt->rate >= 0)
403+
if (rt->rate < ARRAY_SIZE(rates))
404404
alsa_rt->hw.rates = rates_alsaid[rt->rate];
405405
alsa_rt->hw.channels_max = IN_N_CHANNELS;
406406
sub = &rt->capture;

0 commit comments

Comments
 (0)