[alsa-devel] [PATCH] final issues in snd-usb-6fire concerning signedness bug

Takashi Iwai tiwai at suse.de
Thu Jun 16 21:33:19 CEST 2011


At Thu, 16 Jun 2011 21:06:27 +0200,
Torsten Schenk wrote:
> 
> 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 at zoho.com>

Thanks, applied now.
(But at the next, please give a bit better patch subject :)


Takashi

> diff -Nur a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
> --- a/sound/usb/6fire/pcm.c	2011-06-16 20:49:55.859600014 +0200
> +++ b/sound/usb/6fire/pcm.c	2011-06-16 20:48:07.000000000 +0200
> @@ -395,12 +395,12 @@
>  	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;
> 


More information about the Alsa-devel mailing list