From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <error27@gmail.com>
Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] riptide: clean up while loop
Date: Wed, 03 Mar 2010 22:51:22 +0100 [thread overview]
Message-ID: <s5hsk8hm5ut.wl%tiwai@suse.de> (raw)
In-Reply-To: <20100303071349.GG5086@bicker>
At Wed, 3 Mar 2010 10:13:49 +0300,
Dan Carpenter wrote:
>
> If getpaths() returned an odd number this would be a buffer under-run and an
> endless loop. It turns out that getpaths() can only return even numbers, but
> let's make it easy for people auditing code. With the new code you don't
> need to look at getpaths().
>
> This silences a smatch warning.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Applied now. Thanks.
Takashi
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index e66ef2b..a5924af 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry,
> }
> snd_iprintf(buffer, "Paths:\n");
> i = getpaths(cif, p);
> - while (i--) {
> - snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]);
> - i--;
> + while (i >= 2) {
> + i -= 2;
> + snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]);
> }
> snd_iprintf(buffer, "\n");
> }
>
prev parent reply other threads:[~2010-03-03 21:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 7:13 [patch] riptide: clean up while loop Dan Carpenter
2010-03-03 21:51 ` 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=s5hsk8hm5ut.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
/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