lkml.org 
[lkml]   [2018]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 5/7] kernel/kthread.c: do runtime check of format string in kthread_create_on_cpu()
Date
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
\
 
 \ /
  Last update: 2018-10-27 01:24    [W:0.173 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site