Skip to content

Commit

Permalink
ALSA: riptide: clean up while loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
error27 authored and tiwai committed Mar 3, 2010
1 parent e61e642 commit 282572b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/pci/riptide/riptide.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 282572b

Please sign in to comment.