public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <error27@gmail.com>
Cc: alsa-devel@alsa-project.org,
	Torsten Schenk <torsten.schenk@zoho.com>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] USB: 6fire: signedness bug in usb6fire_pcm_prepare()
Date: Mon, 07 Feb 2011 17:30:47 +0000	[thread overview]
Message-ID: <s5hhbcfg3aw.wl%tiwai@suse.de> (raw)
In-Reply-To: <20110207172519.GI4384@bicker>

At Mon, 7 Feb 2011 20:25:19 +0300,
Dan Carpenter wrote:
> 
> rt->rate is an unsigned char so it's never equal to -1.  It's not a huge
> problem because the invalid rate is caught inside the call to
> usb6fire_pcm_set_rate() which returns -EINVAL.  But if we fix the test
> then it prints out the correct error message so that's good.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied now.  Thanks.


Takashi

> diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
> index 705c88e..ba62c74 100644
> --- a/sound/usb/6fire/pcm.c
> +++ b/sound/usb/6fire/pcm.c
> @@ -493,13 +493,12 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
>  	sub->period_off = 0;
>  
>  	if (rt->stream_state = STREAM_DISABLED) {
> -		rt->rate = -1;
>  		for (i = 0; i < ARRAY_SIZE(rates); i++)
>  			if (alsa_rt->rate = rates[i]) {
>  				rt->rate = i;
>  				break;
>  			}
> -		if (rt->rate = -1) {
> +		if (i = ARRAY_SIZE(rates)) {
>  			mutex_unlock(&rt->stream_mutex);
>  			snd_printk("invalid rate %d in prepare.\n",
>  					alsa_rt->rate);
> 

      reply	other threads:[~2011-02-07 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 17:25 [patch] USB: 6fire: signedness bug in usb6fire_pcm_prepare() Dan Carpenter
2011-02-07 17:30 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hhbcfg3aw.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=torsten.schenk@zoho.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox