Skip to contentSkip to conversation

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

PATCH Stephen Rothwell 2 participants 2 messages Jun 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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 <[email protected]>
Date: Fri, 23 Jun 2023 14:24:29 +1000
Subject: [PATCH] fix up for "dm ioctl: Check dm_target_spec is sufficiently aligned"

---
 drivers/md/dm-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ioctl.c +1 -1
index 5f0b641538d8..8b480d7825fe 100644
@@ -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;
 	}
Signature · 5 lines
2.39.2

-- 
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 32 lines · Stephen Rothwell

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'

Quoted 7 lines
 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.

Quoted 26 lines

I have applied the following patch for today:

From: Stephen Rothwell <[email protected]>
Date: Fri, 23 Jun 2023 14:24:29 +1000
Subject: [PATCH] fix up for "dm ioctl: Check dm_target_spec is sufficiently aligned"

---
 drivers/md/dm-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ioctl.c +1 -1
index 5f0b641538d8..8b480d7825fe 100644
@@ -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;
 	}
Signature · 1 line
2.39.2

That fix is correct, thanks!

Signature · 3 lines
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab