linux-next: build failure after merge of the device-mapper tree

Message ID 20230623143011.7deba53c@canb.auug.org.au
State New
Headers
Series linux-next: build failure after merge of the device-mapper tree |

Commit Message

Stephen Rothwell June 23, 2023, 4:30 a.m. UTC
  Hi all,

After merging the device-mapper tree, today's linux-next build (i386
defconfig) failed like this:

In file included from include/linux/kernel.h:30,
                 from arch/x86/include/asm/percpu.h:27,
                 from arch/x86/include/asm/current.h:10,
                 from include/linux/sched.h:12,
                 from include/linux/kthread.h:6,
                 from drivers/md/dm-core.h:13,
                 from drivers/md/dm-ioctl.c:9:
drivers/md/dm-ioctl.c: In function 'next_target':
include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Werror=format=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
include/linux/printk.h:427:25: note: in definition of macro 'printk_index_wrap'
  427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
include/linux/printk.h:498:9: note: in expansion of macro 'printk'
  498 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~
include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
   11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
      |                         ^~~~~~~~
include/linux/printk.h:498:16: note: in expansion of macro 'KERN_ERR'
  498 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |                ^~~~~~~~
include/linux/device-mapper.h:626:25: note: in expansion of macro 'pr_err'
  626 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
      |                         ^~~~~~
drivers/md/dm-ioctl.c:1421:17: note: in expansion of macro 'DMERR'
 1421 |                 DMERR("Next dm_target_spec (offset %u) is not %lu-byte aligned",
      |                 ^~~~~
cc1: all warnings being treated as errors

Caused by commit

  5df1daff2cc6 ("dm ioctl: Check dm_target_spec is sufficiently aligned")

I have applied the following patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 23 Jun 2023 14:24:29 +1000
Subject: [PATCH] fix up for "dm ioctl: Check dm_target_spec is sufficiently aligned"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/md/dm-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Demi Marie Obenour June 23, 2023, 4:47 p.m. UTC | #1
On Fri, Jun 23, 2023 at 02:30:11PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the device-mapper tree, today's linux-next build (i386
> defconfig) failed like this:
> 
> In file included from include/linux/kernel.h:30,
>                  from arch/x86/include/asm/percpu.h:27,
>                  from arch/x86/include/asm/current.h:10,
>                  from include/linux/sched.h:12,
>                  from include/linux/kthread.h:6,
>                  from drivers/md/dm-core.h:13,
>                  from drivers/md/dm-ioctl.c:9:
> drivers/md/dm-ioctl.c: In function 'next_target':
> include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Werror=format=]
>     5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
>       |                         ^~~~~~
> include/linux/printk.h:427:25: note: in definition of macro 'printk_index_wrap'
>   427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
>       |                         ^~~~
> include/linux/printk.h:498:9: note: in expansion of macro 'printk'
>   498 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |         ^~~~~~
> include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
>    11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
>       |                         ^~~~~~~~
> include/linux/printk.h:498:16: note: in expansion of macro 'KERN_ERR'
>   498 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |                ^~~~~~~~
> include/linux/device-mapper.h:626:25: note: in expansion of macro 'pr_err'
>   626 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
>       |                         ^~~~~~
> drivers/md/dm-ioctl.c:1421:17: note: in expansion of macro 'DMERR'
>  1421 |                 DMERR("Next dm_target_spec (offset %u) is not %lu-byte aligned",
>       |                 ^~~~~
> cc1: all warnings being treated as errors
> 
> Caused by commit
> 
>   5df1daff2cc6 ("dm ioctl: Check dm_target_spec is sufficiently aligned")

Ugh, sorry about that.  I’m pretty sure the code would actually work
okay at runtime since unsigned long and unsigned int are passed the same
way, but this is still a bug.

> I have applied the following patch for today:
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Fri, 23 Jun 2023 14:24:29 +1000
> Subject: [PATCH] fix up for "dm ioctl: Check dm_target_spec is sufficiently aligned"
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  drivers/md/dm-ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
> index 5f0b641538d8..8b480d7825fe 100644
> --- a/drivers/md/dm-ioctl.c
> +++ b/drivers/md/dm-ioctl.c
> @@ -1418,7 +1418,7 @@ static int next_target(struct dm_target_spec *last, uint32_t next, const char *e
>  	}
>  
>  	if (next % __alignof__(struct dm_target_spec)) {
> -		DMERR("Next dm_target_spec (offset %u) is not %lu-byte aligned",
> +		DMERR("Next dm_target_spec (offset %u) is not %zu-byte aligned",
>  		      next, __alignof__(struct dm_target_spec));
>  		return -EINVAL;
>  	}
> -- 
> 2.39.2

That fix is correct, thanks!
  

Patch

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 5f0b641538d8..8b480d7825fe 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1418,7 +1418,7 @@  static int next_target(struct dm_target_spec *last, uint32_t next, const char *e
 	}
 
 	if (next % __alignof__(struct dm_target_spec)) {
-		DMERR("Next dm_target_spec (offset %u) is not %lu-byte aligned",
+		DMERR("Next dm_target_spec (offset %u) is not %zu-byte aligned",
 		      next, __alignof__(struct dm_target_spec));
 		return -EINVAL;
 	}