aboutsummaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-03 10:13:49 +0300
committerTakashi Iwai <tiwai@suse.de>2010-03-03 22:41:42 +0100
commit282572b5ab99cf27073210ca60b80dd085e1a469 (patch)
tree223db4faabe0ea81bb99aa9458a5b2626798fa08 /sound/pci
parente61e642c2a0dc283c52cec76a223ac0699773633 (diff)
downloadlinux-2.6.34-ux500-282572b5ab99cf27073210ca60b80dd085e1a469.tar.gz
ALSA: riptide: clean up while loop
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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/riptide/riptide.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 960a227eb65..ad446267761 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");
}