diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c index 88d4a5a298..44571e7865 100644 --- a/drivers/note/note_driver.c +++ b/drivers/note/note_driver.c @@ -1195,6 +1195,7 @@ void sched_note_syscall_enter(int nr, int argc, ...) for (driver = g_note_drivers; *driver; driver++) { va_list copy; + va_copy(copy, ap); if (note_syscall_enter(*driver, nr, argc, ©)) { @@ -1202,9 +1203,9 @@ void sched_note_syscall_enter(int nr, int argc, ...) continue; } - va_end(copy); if ((*driver)->ops->add == NULL) { + va_end(copy); continue; } @@ -1231,6 +1232,8 @@ void sched_note_syscall_enter(int nr, int argc, ...) } } + va_end(copy); + /* Add the note to circular buffer */ note_add(*driver, ¬e, length);