History

workqueue: Don't call va_start / va_end twice

Calling va_start / va_end multiple times is undefined and causes problems with certain compiler / platforms. Change alloc_ordered_workqueue_lockdep_map to a macro and updated __alloc_workqueue to take a va_list argument.

Matthew Brost committed 2 years ago

Commit 9b59a851 parent 8dffaec2 files · +3 −19Browse files

Showing the changes to kernel/workqueue.c (1 of 2 files). Show all

Unified · Split

kernel/workqueue.c+1−5
@@ -5619,12 +5619,10 @@ static void wq_adjust_max_active(struct workqueue_struct *wq) · 5618 unmodified lines
56195619 } while (activated);
56205620 }
56215621
5622−__printf(1, 4)
56235622 static struct workqueue_struct *__alloc_workqueue(const char *fmt,
56245623 unsigned int flags,
5625− int max_active, ...)
5624+ int max_active, va_list args)
56265625 {
5627− va_list args;
56285626 struct workqueue_struct *wq;
56295627 size_t wq_size;
56305628 int name_len;
@@ -5656,9 +5654,7 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt, · 25 unmodified lines
56565654 goto err_free_wq;
56575655 }
56585656
5659− va_start(args, max_active);
56605657 name_len = vsnprintf(wq->name, sizeof(wq->name), fmt, args);
5661− va_end(args);
56625658
56635659 if (name_len >= WQ_NAME_LEN)
56645660 pr_warn_once("workqueue: name exceeds WQ_NAME_LEN. Truncating to: %s\n",