Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1530771 > unrolled thread
| Started by | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| First post | 2016-11-26 20:40 +0100 |
| Last post | 2016-11-28 11:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] kthread: add __printf attributes Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-11-26 20:40 +0100
Re: [PATCH 1/1] kthread: add __printf attributes Petr Mladek <pmladek@suse.com> - 2016-11-28 11:30 +0100
| From | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| Date | 2016-11-26 20:40 +0100 |
| Subject | [PATCH 1/1] kthread: add __printf attributes |
| Message-ID | <sHQZk-2nj-15@gated-at.bofh.it> |
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.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
include/linux/kthread.h | 2 +-
kernel/kthread.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index a6e82a69c363..4de93a54f20b 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -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[], ...);
diff --git a/kernel/kthread.c b/kernel/kthread.c
index be2cc1f9dd57..2baf9354c5fc 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -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)
{
--
2.10.2
[toc] | [next] | [standalone]
| From | Petr Mladek <pmladek@suse.com> |
|---|---|
| Date | 2016-11-28 11:30 +0100 |
| Message-ID | <sIrma-Si-21@gated-at.bofh.it> |
| In reply to | #1530771 |
On Sat 2016-11-26 20:35:43, Nicolas Iooss wrote:
> 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.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Thanks for the fix.
Reviewed-by: Petr Mladek <pmladek@suse.com>
> ---
> include/linux/kthread.h | 2 +-
> kernel/kthread.c | 5 +++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/kthread.h b/include/linux/kthread.h
> index a6e82a69c363..4de93a54f20b 100644
> --- a/include/linux/kthread.h
> +++ b/include/linux/kthread.h
> @@ -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[], ...);
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index be2cc1f9dd57..2baf9354c5fc 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web