aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-10-24 14:55:46 +0200
committerChris Wright <chrisw@sous-sol.org>2006-11-03 17:33:46 -0800
commit1e4007bf4ef92fc6d2afa418c1b49921a7c7d0b3 (patch)
tree3e481daec649d0779e5ac6a04dd5ff60cdcc8e01
parent8354b19683679cd0f0e31e750d846d796c0b5dea (diff)
[PATCH] ALSA: Fix re-use of va_list
The va_list is designed to be used only once. The current code may pass va_list arguments multiple times and may cause Oops. Copy/release the arguments temporarily to avoid this problem. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r--sound/core/info.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 340332c6d97..57821ceb17b 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -119,7 +119,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...)
len = buffer->len - buffer->size;
va_start(args, fmt);
for (;;) {
- res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args);
+ va_list ap;
+ va_copy(ap, args);
+ res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
+ va_end(ap);
if (res < len)
break;
err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);