linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kcsan: fix printk format string
@ 2021-04-21 13:50 Arnd Bergmann
  2021-04-21 13:59 ` Marco Elver
  2021-04-23  6:52 ` [tip: locking/core] kcsan: Fix " tip-bot2 for Arnd Bergmann
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-04-21 13:50 UTC (permalink / raw)
  To: Marco Elver, Paul E. McKenney, David Gow
  Cc: Arnd Bergmann, Dmitry Vyukov, Peter Zijlstra (Intel),
	kasan-dev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Printing a 'long' variable using the '%d' format string is wrong
and causes a warning from gcc:

kernel/kcsan/kcsan_test.c: In function 'nthreads_gen_params':
include/linux/kern_levels.h:5:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Werror=format=]

Use the appropriate format modifier.

Fixes: f6a149140321 ("kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/kcsan/kcsan_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c
index 9247009295b5..a29e9b1a30c8 100644
--- a/kernel/kcsan/kcsan_test.c
+++ b/kernel/kcsan/kcsan_test.c
@@ -981,7 +981,7 @@ static const void *nthreads_gen_params(const void *prev, char *desc)
 		const long min_required_cpus = 2 + min_unused_cpus;
 
 		if (num_online_cpus() < min_required_cpus) {
-			pr_err_once("Too few online CPUs (%u < %d) for test\n",
+			pr_err_once("Too few online CPUs (%u < %ld) for test\n",
 				    num_online_cpus(), min_required_cpus);
 			nthreads = 0;
 		} else if (nthreads >= num_online_cpus() - min_unused_cpus) {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kcsan: fix printk format string
  2021-04-21 13:50 [PATCH] kcsan: fix printk format string Arnd Bergmann
@ 2021-04-21 13:59 ` Marco Elver
  2021-04-21 14:53   ` Paul E. McKenney
  2021-04-23  6:52 ` [tip: locking/core] kcsan: Fix " tip-bot2 for Arnd Bergmann
  1 sibling, 1 reply; 4+ messages in thread
From: Marco Elver @ 2021-04-21 13:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Paul E. McKenney, David Gow, Arnd Bergmann, Dmitry Vyukov,
	Peter Zijlstra (Intel),
	kasan-dev, LKML, Ingo Molnar

On Wed, 21 Apr 2021 at 15:51, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Printing a 'long' variable using the '%d' format string is wrong
> and causes a warning from gcc:
>
> kernel/kcsan/kcsan_test.c: In function 'nthreads_gen_params':
> include/linux/kern_levels.h:5:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Werror=format=]
>
> Use the appropriate format modifier.
>
> Fixes: f6a149140321 ("kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Marco Elver <elver@google.com>

Thank you!

Normally KCSAN patches go through -rcu, but perhaps in this instance
it should be picked up into -tip/locking/core directly, so it goes out
with "kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests".
Paul, Ingo, do you have a preference?

Thanks,
-- Marco

> ---
>  kernel/kcsan/kcsan_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c
> index 9247009295b5..a29e9b1a30c8 100644
> --- a/kernel/kcsan/kcsan_test.c
> +++ b/kernel/kcsan/kcsan_test.c
> @@ -981,7 +981,7 @@ static const void *nthreads_gen_params(const void *prev, char *desc)
>                 const long min_required_cpus = 2 + min_unused_cpus;
>
>                 if (num_online_cpus() < min_required_cpus) {
> -                       pr_err_once("Too few online CPUs (%u < %d) for test\n",
> +                       pr_err_once("Too few online CPUs (%u < %ld) for test\n",
>                                     num_online_cpus(), min_required_cpus);
>                         nthreads = 0;
>                 } else if (nthreads >= num_online_cpus() - min_unused_cpus) {
> --
> 2.29.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kcsan: fix printk format string
  2021-04-21 13:59 ` Marco Elver
@ 2021-04-21 14:53   ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2021-04-21 14:53 UTC (permalink / raw)
  To: Marco Elver
  Cc: Arnd Bergmann, David Gow, Arnd Bergmann, Dmitry Vyukov,
	Peter Zijlstra (Intel),
	kasan-dev, LKML, Ingo Molnar

On Wed, Apr 21, 2021 at 03:59:40PM +0200, Marco Elver wrote:
> On Wed, 21 Apr 2021 at 15:51, Arnd Bergmann <arnd@kernel.org> wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > Printing a 'long' variable using the '%d' format string is wrong
> > and causes a warning from gcc:
> >
> > kernel/kcsan/kcsan_test.c: In function 'nthreads_gen_params':
> > include/linux/kern_levels.h:5:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Werror=format=]
> >
> > Use the appropriate format modifier.
> >
> > Fixes: f6a149140321 ("kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Reviewed-by: Marco Elver <elver@google.com>
> 
> Thank you!
> 
> Normally KCSAN patches go through -rcu, but perhaps in this instance
> it should be picked up into -tip/locking/core directly, so it goes out
> with "kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests".
> Paul, Ingo, do you have a preference?

I am good either way.  I have queued it for the moment, but will remove
it if Ingo takes it.

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> Thanks,
> -- Marco
> 
> > ---
> >  kernel/kcsan/kcsan_test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c
> > index 9247009295b5..a29e9b1a30c8 100644
> > --- a/kernel/kcsan/kcsan_test.c
> > +++ b/kernel/kcsan/kcsan_test.c
> > @@ -981,7 +981,7 @@ static const void *nthreads_gen_params(const void *prev, char *desc)
> >                 const long min_required_cpus = 2 + min_unused_cpus;
> >
> >                 if (num_online_cpus() < min_required_cpus) {
> > -                       pr_err_once("Too few online CPUs (%u < %d) for test\n",
> > +                       pr_err_once("Too few online CPUs (%u < %ld) for test\n",
> >                                     num_online_cpus(), min_required_cpus);
> >                         nthreads = 0;
> >                 } else if (nthreads >= num_online_cpus() - min_unused_cpus) {
> > --
> > 2.29.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: locking/core] kcsan: Fix printk format string
  2021-04-21 13:50 [PATCH] kcsan: fix printk format string Arnd Bergmann
  2021-04-21 13:59 ` Marco Elver
@ 2021-04-23  6:52 ` tip-bot2 for Arnd Bergmann
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2021-04-23  6:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arnd Bergmann, Peter Zijlstra (Intel),
	Marco Elver, Paul E. McKenney, x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     f4abe9967c6fdb511ee567e129a014b60945ab93
Gitweb:        https://git.kernel.org/tip/f4abe9967c6fdb511ee567e129a014b60945ab93
Author:        Arnd Bergmann <arnd@arndb.de>
AuthorDate:    Wed, 21 Apr 2021 15:50:38 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 22 Apr 2021 14:36:03 +02:00

kcsan: Fix printk format string

Printing a 'long' variable using the '%d' format string is wrong
and causes a warning from gcc:

kernel/kcsan/kcsan_test.c: In function 'nthreads_gen_params':
include/linux/kern_levels.h:5:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Werror=format=]

Use the appropriate format modifier.

Fixes: f6a149140321 ("kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Marco Elver <elver@google.com>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lkml.kernel.org/r/20210421135059.3371701-1-arnd@kernel.org
---
 kernel/kcsan/kcsan_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c
index b71751f..8bcffbd 100644
--- a/kernel/kcsan/kcsan_test.c
+++ b/kernel/kcsan/kcsan_test.c
@@ -984,7 +984,7 @@ static const void *nthreads_gen_params(const void *prev, char *desc)
 		const long min_required_cpus = 2 + min_unused_cpus;
 
 		if (num_online_cpus() < min_required_cpus) {
-			pr_err_once("Too few online CPUs (%u < %d) for test\n",
+			pr_err_once("Too few online CPUs (%u < %ld) for test\n",
 				    num_online_cpus(), min_required_cpus);
 			nthreads = 0;
 		} else if (nthreads >= num_online_cpus() - min_unused_cpus) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-23  6:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 13:50 [PATCH] kcsan: fix printk format string Arnd Bergmann
2021-04-21 13:59 ` Marco Elver
2021-04-21 14:53   ` Paul E. McKenney
2021-04-23  6:52 ` [tip: locking/core] kcsan: Fix " tip-bot2 for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).