2023-06-23 04:40:58

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the device-mapper tree

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"

Signed-off-by: Stephen Rothwell <[email protected]>
---
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

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-06-23 16:56:05

by Demi Marie Obenour

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the device-mapper tree

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 <[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"
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> 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!
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab


Attachments:
(No filename) (3.34 kB)
signature.asc (849.00 B)
Download all attachments