Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Link: http://lkml.kernel.org/r/20161126193543.22672-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nicolas Iooss and committed by
Linus Torvalds
c0b942a7 df5f0f0a

+4 -3
+1 -1
include/linux/kthread.h
··· 175 175 struct kthread_worker * 176 176 kthread_create_worker(unsigned int flags, const char namefmt[], ...); 177 177 178 - struct kthread_worker * 178 + __printf(3, 4) struct kthread_worker * 179 179 kthread_create_worker_on_cpu(int cpu, unsigned int flags, 180 180 const char namefmt[], ...); 181 181
+3 -2
kernel/kthread.c
··· 261 261 } 262 262 } 263 263 264 - static struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data), 264 + static __printf(4, 0) 265 + struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data), 265 266 void *data, int node, 266 267 const char namefmt[], 267 268 va_list args) ··· 636 635 } 637 636 EXPORT_SYMBOL_GPL(kthread_worker_fn); 638 637 639 - static struct kthread_worker * 638 + static __printf(3, 0) struct kthread_worker * 640 639 __kthread_create_worker(int cpu, unsigned int flags, 641 640 const char namefmt[], va_list args) 642 641 {