]> err.no Git - linux-2.6/commitdiff
[ALSA] Fix re-use of va_list
authorTakashi Iwai <tiwai@suse.de>
Wed, 18 Oct 2006 17:09:46 +0000 (19:09 +0200)
committerJaroslav Kysela <perex@suse.cz>
Sun, 22 Oct 2006 08:51:13 +0000 (10:51 +0200)
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: Jaroslav Kysela <perex@suse.cz>
sound/core/info.c

index e43662b33f16e6ce7bf3b975175639194d6ced3f..0b4aab3225e5270a998e77e06e7821973b3e2146 100644 (file)
@@ -120,7 +120,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);