From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] final issues in snd-usb-6fire concerning signedness bug Date: Thu, 16 Jun 2011 21:33:19 +0200 Message-ID: References: <12d995c1fa0.477955495632923443.5387390398635058860@zoho.com> <12da59486cd.-2882799020629445819.-7235974021966893201@zoho.com> <12da867d460.-8772675728917411279.-4777530225625691984@zoho.com> <12f0d60921e.7616534511239462585.4849758772336073987@zoho.com> <13099d8e809.-433657093718378069.6298655438333370759@zoho.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id DD2D724480 for ; Thu, 16 Jun 2011 21:33:24 +0200 (CEST) In-Reply-To: <13099d8e809.-433657093718378069.6298655438333370759@zoho.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Torsten Schenk Cc: alsa-devel@alsa-project.org, clemens@ladisch.de List-Id: alsa-devel@alsa-project.org 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 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; >