[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181026232409.16100-6-linux@rasmusvillemoes.dk>
Date: Sat, 27 Oct 2018 01:24:07 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>
Subject: [RFC PATCH 5/7] kernel/kthread.c: do runtime check of format string in kthread_create_on_cpu()
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@...musvillemoes.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
Powered by blists - more mailing lists