From: Takashi Iwai Date: Wed, 18 Oct 2006 17:09:46 +0000 (+0200) Subject: [ALSA] Fix re-use of va_list X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=dbedca39fe30db87b6401e4396f959c63d90082e;p=openwrt%2Fstaging%2Fblogic.git [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 Signed-off-by: Jaroslav Kysela --- diff --git a/sound/core/info.c b/sound/core/info.c index e43662b33f16..0b4aab3225e5 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -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);