public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu()
@ 2024-09-30 15:44 Alexander Lobakin
  2024-10-01  8:58 ` Lorenzo Pieralisi
  2024-10-09 15:26 ` Alexander Lobakin
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Lobakin @ 2024-09-30 15:44 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi
  Cc: Alexander Lobakin, Kevin Brodsky, Paul E. McKenney, Arnd Bergmann,
	kernel test robot, nex.sw.ncis.osdt.itp.upstreaming,
	linux-arm-kernel, stable, linux-kernel

kthread_create_on_cpu() always requires format string to contain one
'%u' at the end, as it automatically adds the CPU ID when passing it
to kthread_create_on_node(). The former isn't marked as __printf()
as it's not printf-like itself, which effectively hides this from
the compiler.
If you convert this function to printf-like, you'll see the following:

In file included from drivers/firmware/psci/psci_checker.c:15:
drivers/firmware/psci/psci_checker.c: In function 'suspend_tests':
drivers/firmware/psci/psci_checker.c:401:48: warning: too many arguments for format [-Wformat-extra-args]
     401 |                                                "psci_suspend_test");
         |                                                ^~~~~~~~~~~~~~~~~~~
drivers/firmware/psci/psci_checker.c:400:32: warning: data argument not used by format string [-Wformat-extra-args]
     400 |                                                (void *)(long)cpu, cpu,
         |                                                                   ^
     401 |                                                "psci_suspend_test");
         |                                                ~~~~~~~~~~~~~~~~~~~

Add the missing format literal to fix this. Now the corresponding
kthread will be named as "psci_suspend_test-<cpuid>", as it's meant by
kthread_create_on_cpu().

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408141012.KhvKaxoh-lkp@intel.com
Closes: https://lore.kernel.org/oe-kbuild-all/202408141243.eQiEOQQe-lkp@intel.com
Fixes: ea8b1c4a6019 ("drivers: psci: PSCI checker module")
Cc: stable@vger.kernel.org # 4.10+
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
---
 drivers/firmware/psci/psci_checker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
index 116eb465cdb4..ecc511c745ce 100644
--- a/drivers/firmware/psci/psci_checker.c
+++ b/drivers/firmware/psci/psci_checker.c
@@ -398,7 +398,7 @@ static int suspend_tests(void)
 
 		thread = kthread_create_on_cpu(suspend_test_thread,
 					       (void *)(long)cpu, cpu,
-					       "psci_suspend_test");
+					       "psci_suspend_test-%u");
 		if (IS_ERR(thread))
 			pr_err("Failed to create kthread on CPU %d\n", cpu);
 		else
-- 
2.46.2



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

* Re: [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu()
  2024-09-30 15:44 [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu() Alexander Lobakin
@ 2024-10-01  8:58 ` Lorenzo Pieralisi
  2024-10-09 15:26 ` Alexander Lobakin
  1 sibling, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2024-10-01  8:58 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Mark Rutland, Kevin Brodsky, Paul E. McKenney, Arnd Bergmann,
	kernel test robot, nex.sw.ncis.osdt.itp.upstreaming,
	linux-arm-kernel, stable, linux-kernel

On Mon, Sep 30, 2024 at 05:44:33PM +0200, Alexander Lobakin wrote:
> kthread_create_on_cpu() always requires format string to contain one
> '%u' at the end, as it automatically adds the CPU ID when passing it
> to kthread_create_on_node(). The former isn't marked as __printf()
> as it's not printf-like itself, which effectively hides this from
> the compiler.
> If you convert this function to printf-like, you'll see the following:
> 
> In file included from drivers/firmware/psci/psci_checker.c:15:
> drivers/firmware/psci/psci_checker.c: In function 'suspend_tests':
> drivers/firmware/psci/psci_checker.c:401:48: warning: too many arguments for format [-Wformat-extra-args]
>      401 |                                                "psci_suspend_test");
>          |                                                ^~~~~~~~~~~~~~~~~~~
> drivers/firmware/psci/psci_checker.c:400:32: warning: data argument not used by format string [-Wformat-extra-args]
>      400 |                                                (void *)(long)cpu, cpu,
>          |                                                                   ^
>      401 |                                                "psci_suspend_test");
>          |                                                ~~~~~~~~~~~~~~~~~~~
> 
> Add the missing format literal to fix this. Now the corresponding
> kthread will be named as "psci_suspend_test-<cpuid>", as it's meant by
> kthread_create_on_cpu().
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202408141012.KhvKaxoh-lkp@intel.com
> Closes: https://lore.kernel.org/oe-kbuild-all/202408141243.eQiEOQQe-lkp@intel.com
> Fixes: ea8b1c4a6019 ("drivers: psci: PSCI checker module")
> Cc: stable@vger.kernel.org # 4.10+
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
>  drivers/firmware/psci/psci_checker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>

> diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
> index 116eb465cdb4..ecc511c745ce 100644
> --- a/drivers/firmware/psci/psci_checker.c
> +++ b/drivers/firmware/psci/psci_checker.c
> @@ -398,7 +398,7 @@ static int suspend_tests(void)
>  
>  		thread = kthread_create_on_cpu(suspend_test_thread,
>  					       (void *)(long)cpu, cpu,
> -					       "psci_suspend_test");
> +					       "psci_suspend_test-%u");
>  		if (IS_ERR(thread))
>  			pr_err("Failed to create kthread on CPU %d\n", cpu);
>  		else
> -- 
> 2.46.2
> 


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

* Re: [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu()
  2024-09-30 15:44 [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu() Alexander Lobakin
  2024-10-01  8:58 ` Lorenzo Pieralisi
@ 2024-10-09 15:26 ` Alexander Lobakin
  2024-10-09 15:29   ` Mark Rutland
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Lobakin @ 2024-10-09 15:26 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi
  Cc: Kevin Brodsky, Paul E. McKenney, Arnd Bergmann, kernel test robot,
	nex.sw.ncis.osdt.itp.upstreaming, linux-arm-kernel, stable,
	linux-kernel

From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Mon, 30 Sep 2024 17:44:33 +0200

> kthread_create_on_cpu() always requires format string to contain one
> '%u' at the end, as it automatically adds the CPU ID when passing it
> to kthread_create_on_node(). The former isn't marked as __printf()
> as it's not printf-like itself, which effectively hides this from
> the compiler.
> If you convert this function to printf-like, you'll see the following:
> 
> In file included from drivers/firmware/psci/psci_checker.c:15:
> drivers/firmware/psci/psci_checker.c: In function 'suspend_tests':
> drivers/firmware/psci/psci_checker.c:401:48: warning: too many arguments for format [-Wformat-extra-args]
>      401 |                                                "psci_suspend_test");
>          |                                                ^~~~~~~~~~~~~~~~~~~
> drivers/firmware/psci/psci_checker.c:400:32: warning: data argument not used by format string [-Wformat-extra-args]
>      400 |                                                (void *)(long)cpu, cpu,
>          |                                                                   ^
>      401 |                                                "psci_suspend_test");
>          |                                                ~~~~~~~~~~~~~~~~~~~
> 
> Add the missing format literal to fix this. Now the corresponding
> kthread will be named as "psci_suspend_test-<cpuid>", as it's meant by
> kthread_create_on_cpu().
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202408141012.KhvKaxoh-lkp@intel.com
> Closes: https://lore.kernel.org/oe-kbuild-all/202408141243.eQiEOQQe-lkp@intel.com
> Fixes: ea8b1c4a6019 ("drivers: psci: PSCI checker module")
> Cc: stable@vger.kernel.org # 4.10+
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>

Ping? Who's taking this?

> ---
>  drivers/firmware/psci/psci_checker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
> index 116eb465cdb4..ecc511c745ce 100644
> --- a/drivers/firmware/psci/psci_checker.c
> +++ b/drivers/firmware/psci/psci_checker.c
> @@ -398,7 +398,7 @@ static int suspend_tests(void)
>  
>  		thread = kthread_create_on_cpu(suspend_test_thread,
>  					       (void *)(long)cpu, cpu,
> -					       "psci_suspend_test");
> +					       "psci_suspend_test-%u");
>  		if (IS_ERR(thread))
>  			pr_err("Failed to create kthread on CPU %d\n", cpu);
>  		else

Thanks,
Olek


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

* Re: [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu()
  2024-10-09 15:26 ` Alexander Lobakin
@ 2024-10-09 15:29   ` Mark Rutland
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2024-10-09 15:29 UTC (permalink / raw)
  To: Alexander Lobakin, Arnd Bergmann
  Cc: Lorenzo Pieralisi, Kevin Brodsky, Paul E. McKenney,
	kernel test robot, nex.sw.ncis.osdt.itp.upstreaming,
	linux-arm-kernel, stable, linux-kernel

On Wed, Oct 09, 2024 at 05:26:18PM +0200, Alexander Lobakin wrote:
> From: Alexander Lobakin <aleksander.lobakin@intel.com>
> Date: Mon, 30 Sep 2024 17:44:33 +0200
> 
> > kthread_create_on_cpu() always requires format string to contain one
> > '%u' at the end, as it automatically adds the CPU ID when passing it
> > to kthread_create_on_node(). The former isn't marked as __printf()
> > as it's not printf-like itself, which effectively hides this from
> > the compiler.
> > If you convert this function to printf-like, you'll see the following:
> > 
> > In file included from drivers/firmware/psci/psci_checker.c:15:
> > drivers/firmware/psci/psci_checker.c: In function 'suspend_tests':
> > drivers/firmware/psci/psci_checker.c:401:48: warning: too many arguments for format [-Wformat-extra-args]
> >      401 |                                                "psci_suspend_test");
> >          |                                                ^~~~~~~~~~~~~~~~~~~
> > drivers/firmware/psci/psci_checker.c:400:32: warning: data argument not used by format string [-Wformat-extra-args]
> >      400 |                                                (void *)(long)cpu, cpu,
> >          |                                                                   ^
> >      401 |                                                "psci_suspend_test");
> >          |                                                ~~~~~~~~~~~~~~~~~~~
> > 
> > Add the missing format literal to fix this. Now the corresponding
> > kthread will be named as "psci_suspend_test-<cpuid>", as it's meant by
> > kthread_create_on_cpu().
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202408141012.KhvKaxoh-lkp@intel.com
> > Closes: https://lore.kernel.org/oe-kbuild-all/202408141243.eQiEOQQe-lkp@intel.com
> > Fixes: ea8b1c4a6019 ("drivers: psci: PSCI checker module")
> > Cc: stable@vger.kernel.org # 4.10+
> > Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> 
> Ping? Who's taking this?

I would expect this to go through the soc tree.

Arnd, are you happy to pick this up?

FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> 
> > ---
> >  drivers/firmware/psci/psci_checker.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
> > index 116eb465cdb4..ecc511c745ce 100644
> > --- a/drivers/firmware/psci/psci_checker.c
> > +++ b/drivers/firmware/psci/psci_checker.c
> > @@ -398,7 +398,7 @@ static int suspend_tests(void)
> >  
> >  		thread = kthread_create_on_cpu(suspend_test_thread,
> >  					       (void *)(long)cpu, cpu,
> > -					       "psci_suspend_test");
> > +					       "psci_suspend_test-%u");
> >  		if (IS_ERR(thread))
> >  			pr_err("Failed to create kthread on CPU %d\n", cpu);
> >  		else
> 
> Thanks,
> Olek


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

end of thread, other threads:[~2024-10-09 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 15:44 [PATCH] firmware/psci: fix missing '%u' format literal in kthread_create_on_cpu() Alexander Lobakin
2024-10-01  8:58 ` Lorenzo Pieralisi
2024-10-09 15:26 ` Alexander Lobakin
2024-10-09 15:29   ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox