summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorsten Schenk <torsten.schenk@zoho.com>2011-06-16 21:06:27 +0200
committerTakashi Iwai <tiwai@suse.de>2011-06-16 21:31:33 +0200
commit0ec5258d68c626922d92e2f0e4e5c689e5360a5d (patch)
tree0e8a2450585f5602f0b1f1c66131e9830f3fc730
parentALSA: lola - Fix section mismatch (diff)
downloadlinux-0ec5258d68c626922d92e2f0e4e5c689e5360a5d.tar.xz
linux-0ec5258d68c626922d92e2f0e4e5c689e5360a5d.zip
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>
-rw-r--r--sound/usb/6fire/pcm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index b137b25865cc..d144cdb2f159 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -395,12 +395,12 @@ static int usb6fire_pcm_open(struct snd_pcm_substream *alsa_sub)
alsa_rt->hw = pcm_hw;
if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- if (rt->rate >= 0)
+ if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = OUT_N_CHANNELS;
sub = &rt->playback;
} else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) {
- if (rt->rate >= 0)
+ if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = IN_N_CHANNELS;
sub = &rt->capture;