kthread: add __printf attributes
PATCH 1/1 kthread: add __printf attributes
When commit fbae2d44aa1d ("kthread: add kthread_create_worker*()") introduced some kthread_create_...() functions which were taking printf-like parametter, it introduced __printf attributes to some functions (e.g. kthread_create_worker()). Nevertheless some new functions were forgotten (they have been detected thanks to -Wmissing-format-attribute warning flag).
Add the missing __printf attributes to the newly-introduced functions in order to detect formatting issues at build-time with -Wformat flag.
--- include/linux/kthread.h | 2 +- kernel/kthread.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
include/linux/kthread.h +1 -1
@@ -174,7 +174,7 @@ __printf(2, 3)struct kthread_worker *kthread_create_worker (unsigned int flags,const char namefmt[], ...); -struct kthread_worker * +__printf(3, 4) struct kthread_worker *kthread_create_worker_on_cpu (int cpu,unsigned int flags,const char namefmt[], ...);
kernel/kthread.c +3 -2
@@ -244,7 +244,8 @@ static void create_kthread(struct kthread_create_info *create) } } -static struct task_struct *__kthread_create_on_node (int (*threadfn)(void *data), +static __printf(4, 0) +struct task_struct *__kthread_create_on_node (int (*threadfn)(void *data),void *data,int node,const char namefmt[],va_list args)
@@ -630,7 +631,7 @@ int kthread_worker_fn(void *worker_ptr) }EXPORT_SYMBOL_GPL (kthread_worker_fn); -static struct kthread_worker * +static __printf(3, 0) struct kthread_worker * __kthread_create_worker(int cpu, unsigned int flags, const char namefmt[], va_list args) {
Signature · 1 line
2.10.2
Quoted 11 lines · Nicolas Iooss
When commit
fbae2d44aa1d("kthread: add kthread_create_worker*()") introduced some kthread_create_...() functions which were taking printf-like parametter, it introduced__printfattributes to some functions (e.g.kthread_create_worker()). Nevertheless some new functions were forgotten (they have been detected thanks to -Wmissing-format-attribute warning flag).Add the missing
__printfattributes to the newly-introduced functions in order to detect formatting issues at build-time with -Wformat flag.Signed-off-by Nicolas Iooss <[email protected]>
Thanks for the fix.
Quoted 23 lines
--- include/linux/kthread.h | 2 +- kernel/kthread.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)include/linux/kthread.h +1
-1@@ -174,7 +174,7 @@ __printf(2, 3)struct kthread_worker *kthread_create_worker (unsigned int flags,const char namefmt[], ...); -struct kthread_worker * +__printf(3, 4) struct kthread_worker *kthread_create_worker_on_cpu (int cpu,unsigned int flags,const char namefmt[], ...);kernel/kthread.c +0
-0
kernel/kthread.c static void create_kthread(struct kthread_create_info *create) · line 251
Quoted 9 lines
kernel/kthread.c +2
-1@@ -244,7 +244,8 @@ static void create_kthread(struct kthread_create_info *create) } } -static struct task_struct *__kthread_create_on_node (int (*threadfn)(void *data), +static __printf(4, 0) +struct task_struct *__kthread_create_on_node (int (*threadfn)(void *data),void *data,int node,const char namefmt[],va_list args)
It would be great to update the indentation of these three lines as well. But it is just a cosmetic problem.
Best Regards,
Petr