Messages in this thread Patch in this message | | | From | Rasmus Villemoes <> | Subject | [RFC PATCH 5/7] kernel/kthread.c: do runtime check of format string in kthread_create_on_cpu() | Date | Sat, 27 Oct 2018 01:24:07 +0200 |
| |
One is supposed to pass in a format string containing (at most) one %u instance. Use fmtcheck() to enforce that at runtime, WARNing and falling back to a harmless "kthread/%u" in case verification fails.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> --- kernel/kthread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/kthread.c b/kernel/kthread.c index 087d18d771b5..fddfe605632b 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -441,8 +441,8 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), { struct task_struct *p; - p = kthread_create_on_node(threadfn, data, cpu_to_node(cpu), namefmt, - cpu); + p = kthread_create_on_node(threadfn, data, cpu_to_node(cpu), + fmtcheck(namefmt, "kthread/%u", 0), cpu); if (IS_ERR(p)) return p; kthread_bind(p, cpu); -- 2.19.1.6.gbde171bbf5
| |