linux-next: build failure after merge of all the trees

Stephen Rothwell posted 1 patch 2 months, 2 weeks ago
include/linux/sprintf.h | 1 +
1 file changed, 1 insertion(+)
linux-next: build failure after merge of all the trees
Posted by Stephen Rothwell 2 months, 2 weeks ago
Hi all,

After merging all the trees, today's linux-next build (powerpc
allyesconfig) failed like this:

In file included from drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c:4:
include/linux/sprintf.h:11:54: error: unknown type name 'va_list'
   11 | __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
      |                                                      ^~~~~~~
include/linux/sprintf.h:1:1: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
  +++ |+#include <stdarg.h>
    1 | /* SPDX-License-Identifier: GPL-2.0 */
include/linux/sprintf.h:13:71: error: unknown type name 'va_list'
   13 | __printf(3, 0) int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
      |                                                                       ^~~~~~~
include/linux/sprintf.h:13:71: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
include/linux/sprintf.h:15:72: error: unknown type name 'va_list'
   15 | __printf(3, 0) int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
      |                                                                        ^~~~~~~
include/linux/sprintf.h:15:72: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
include/linux/sprintf.h:17:70: error: unknown type name 'va_list'
   17 | __printf(2, 0) __malloc char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
      |                                                                      ^~~~~~~
include/linux/sprintf.h:17:70: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
include/linux/sprintf.h:18:73: error: unknown type name 'va_list'
   18 | __printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args);
      |                                                                         ^~~~~~~
include/linux/sprintf.h:18:73: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
include/linux/sprintf.h:21:55: error: unknown type name 'va_list'
   21 | __scanf(2, 0) int vsscanf(const char *, const char *, va_list);
      |                                                       ^~~~~~~
include/linux/sprintf.h:21:55: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'

I don't know what root caused this, but I have applied the following
patch for today.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 21 Jul 2025 16:15:57 +1000
Subject: [PATCH] sprintf.h requires stdarg.h

In file included from drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c:4:
include/linux/sprintf.h:11:54: error: unknown type name 'va_list'
   11 | __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
      |                                                      ^~~~~~~
include/linux/sprintf.h:1:1: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/sprintf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/sprintf.h b/include/linux/sprintf.h
index 521bb2cd2648..f06f7b785091 100644
--- a/include/linux/sprintf.h
+++ b/include/linux/sprintf.h
@@ -4,6 +4,7 @@
 
 #include <linux/compiler_attributes.h>
 #include <linux/types.h>
+#include <linux/stdarg.h>
 
 int num_to_str(char *buf, int size, unsigned long long num, unsigned int width);
 
-- 
2.50.1

Is there any good reason not to do this?

I guess this patch should have

Fixes: 39ced19b9e60 ("lib/vsprintf: split out sprintf() and friends")

but that is not the immediate cause.  This has been exposed by the
inclusion of a new file
(drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c in commit
7c68005a4610 ("crypto: qat - relocate power management debugfs helper
APIs").  Maybe every other use of sprintf.h also has (explicitly or
implicitly) an include of stdarg.h - possibly via kernel.h.

-- 
Cheers,
Stephen Rothwell
Re: linux-next: build failure after merge of all the trees
Posted by Andy Shevchenko 2 months, 2 weeks ago
On Mon, Jul 21, 2025 at 05:37:54PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging all the trees, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> In file included from drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c:4:
> include/linux/sprintf.h:11:54: error: unknown type name 'va_list'
>    11 | __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
>       |                                                      ^~~~~~~
> include/linux/sprintf.h:1:1: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
>   +++ |+#include <stdarg.h>
>     1 | /* SPDX-License-Identifier: GPL-2.0 */
> include/linux/sprintf.h:13:71: error: unknown type name 'va_list'
>    13 | __printf(3, 0) int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
>       |                                                                       ^~~~~~~
> include/linux/sprintf.h:13:71: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> include/linux/sprintf.h:15:72: error: unknown type name 'va_list'
>    15 | __printf(3, 0) int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
>       |                                                                        ^~~~~~~
> include/linux/sprintf.h:15:72: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> include/linux/sprintf.h:17:70: error: unknown type name 'va_list'
>    17 | __printf(2, 0) __malloc char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
>       |                                                                      ^~~~~~~
> include/linux/sprintf.h:17:70: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> include/linux/sprintf.h:18:73: error: unknown type name 'va_list'
>    18 | __printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args);
>       |                                                                         ^~~~~~~
> include/linux/sprintf.h:18:73: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> include/linux/sprintf.h:21:55: error: unknown type name 'va_list'
>    21 | __scanf(2, 0) int vsscanf(const char *, const char *, va_list);
>       |                                                       ^~~~~~~
> include/linux/sprintf.h:21:55: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> 
> I don't know what root caused this, but I have applied the following
> patch for today.
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Mon, 21 Jul 2025 16:15:57 +1000
> Subject: [PATCH] sprintf.h requires stdarg.h
> 
> In file included from drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c:4:
> include/linux/sprintf.h:11:54: error: unknown type name 'va_list'
>    11 | __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
>       |                                                      ^~~~~~~
> include/linux/sprintf.h:1:1: note: 'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  include/linux/sprintf.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/sprintf.h b/include/linux/sprintf.h
> index 521bb2cd2648..f06f7b785091 100644
> --- a/include/linux/sprintf.h
> +++ b/include/linux/sprintf.h
> @@ -4,6 +4,7 @@
>  
>  #include <linux/compiler_attributes.h>
>  #include <linux/types.h>
> +#include <linux/stdarg.h>
>  
>  int num_to_str(char *buf, int size, unsigned long long num, unsigned int width);
>  
> -- 
> 2.50.1
> 
> Is there any good reason not to do this?
> 
> I guess this patch should have
> 
> Fixes: 39ced19b9e60 ("lib/vsprintf: split out sprintf() and friends")

This sounds correct to me and your patch should be sent as a fix to the stable
kernels as well.

> but that is not the immediate cause.  This has been exposed by the
> inclusion of a new file
> (drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c in commit
> 7c68005a4610 ("crypto: qat - relocate power management debugfs helper
> APIs").  Maybe every other use of sprintf.h also has (explicitly or
> implicitly) an include of stdarg.h - possibly via kernel.h.

It just a first who started using the header in the correct way without
proxying others.


-- 
With Best Regards,
Andy Shevchenko
Re: linux-next: build failure after merge of all the trees
Posted by Andrew Morton 2 months, 2 weeks ago
On Mon, 21 Jul 2025 14:42:22 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > Is there any good reason not to do this?
> > 
> > I guess this patch should have
> > 
> > Fixes: 39ced19b9e60 ("lib/vsprintf: split out sprintf() and friends")
> 
> This sounds correct to me and your patch should be sent as a fix to the stable
> kernels as well.
> 

Yep, thanks, I added the cc:stable, queued it up and shall send to
Linus this week.
Re: linux-next: build failure after merge of all the trees
Posted by Stephen Rothwell 2 months, 2 weeks ago
Hi Andrew,

On Mon, 21 Jul 2025 14:13:36 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Mon, 21 Jul 2025 14:42:22 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > Is there any good reason not to do this?
> > > 
> > > I guess this patch should have
> > > 
> > > Fixes: 39ced19b9e60 ("lib/vsprintf: split out sprintf() and friends")  
> > 
> > This sounds correct to me and your patch should be sent as a fix to the stable
> > kernels as well.
> 
> Yep, thanks, I added the cc:stable, queued it up and shall send to
> Linus this week.

Thanks, I was going to get around to that this morning.  One less thing
to do :-)

-- 
Cheers,
Stephen Rothwell