* [PATCH 0/3] mdadm: minor fixes
@ 2025-05-07 12:19 Xiao Ni
2025-05-07 12:20 ` [PATCH 1/3] mdadm: use standard libc nftw Xiao Ni
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Xiao Ni @ 2025-05-07 12:19 UTC (permalink / raw)
To: linux-raid; +Cc: mtkaczyk, ncroxon
There are some building errors and regression bug.
The PR is at https://github.com/md-raid-utilities/mdadm/pull/178
Xiao Ni (3):
mdadm: use standard libc nftw
mdadm: fix building errors
mdadm: add attribute nonstring for signature
lib.c | 22 ----------------------
platform-intel.h | 2 +-
super-ddf.c | 9 +++++----
super-intel.c | 3 ++-
4 files changed, 8 insertions(+), 28 deletions(-)
--
2.32.0 (Apple Git-132)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] mdadm: use standard libc nftw
2025-05-07 12:19 [PATCH 0/3] mdadm: minor fixes Xiao Ni
@ 2025-05-07 12:20 ` Xiao Ni
2025-05-07 12:20 ` [PATCH 2/3] mdadm: fix building errors Xiao Ni
2025-05-07 12:20 ` [PATCH 3/3] mdadm: add attribute nonstring for signature Xiao Ni
2 siblings, 0 replies; 6+ messages in thread
From: Xiao Ni @ 2025-05-07 12:20 UTC (permalink / raw)
To: linux-raid; +Cc: mtkaczyk, ncroxon
commit bd648e3bec3d ("mdadm: Remove klibc and uclibc support") removes
macro HAVE_NFTW/HAVE_FTW and uses libc header ftw.h. But it leaves the
codes in lib.c which let mdadm command call nftw defined in lib.c. It
needs to remove these codes.
The bug can be reproduced by:
mdadm -CR /dev/md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3
--size 10000 /dev/loop1 /dev/loop2 /dev/loop3
mdadm /dev/md0 --grow --chunk=64
mdadm: /dev/md0: cannot open component -unknown-
Fixes: bd648e3bec3d ("mdadm: Remove klibc and uclibc support")
Signed-off-by: Xiao Ni <xni@redhat.com>
---
lib.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/lib.c b/lib.c
index f36ae03a3fa0..eb6cc1194cab 100644
--- a/lib.c
+++ b/lib.c
@@ -245,28 +245,6 @@ int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
return 0;
}
-#ifndef HAVE_NFTW
-#ifdef HAVE_FTW
-int add_dev_1(const char *name, const struct stat *stb, int flag)
-{
- return add_dev(name, stb, flag, NULL);
-}
-int nftw(const char *path,
- int (*han)(const char *name, const struct stat *stb,
- int flag, struct FTW *s), int nopenfd, int flags)
-{
- return ftw(path, add_dev_1, nopenfd);
-}
-#else
-int nftw(const char *path,
- int (*han)(const char *name, const struct stat *stb,
- int flag, struct FTW *s), int nopenfd, int flags)
-{
- return 0;
-}
-#endif /* HAVE_FTW */
-#endif /* HAVE_NFTW */
-
/*
* Find a block device with the right major/minor number.
* If we find multiple names, choose the shortest.
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] mdadm: fix building errors
2025-05-07 12:19 [PATCH 0/3] mdadm: minor fixes Xiao Ni
2025-05-07 12:20 ` [PATCH 1/3] mdadm: use standard libc nftw Xiao Ni
@ 2025-05-07 12:20 ` Xiao Ni
2025-05-07 13:53 ` Paul Menzel
2025-05-07 12:20 ` [PATCH 3/3] mdadm: add attribute nonstring for signature Xiao Ni
2 siblings, 1 reply; 6+ messages in thread
From: Xiao Ni @ 2025-05-07 12:20 UTC (permalink / raw)
To: linux-raid; +Cc: mtkaczyk, ncroxon
Some building errors are found in ppc64le platform:
format '%llu' expects argument of type 'long long unsigned int', but
argument 3 has type 'long unsigned int' [-Werror=format=]
Signed-off-by: Xiao Ni <xni@redhat.com>
---
super-ddf.c | 9 +++++----
super-intel.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/super-ddf.c b/super-ddf.c
index 6e7db924d2b1..dda8b7fedd64 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -1606,9 +1606,9 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid)
map_num(ddf_sec_level, vc->srl) ?: "-unknown-");
}
printf(" Device Size[%d] : %llu\n", n,
- be64_to_cpu(vc->blocks)/2);
+ (unsigned long long)(be64_to_cpu(vc->blocks)/2));
printf(" Array Size[%d] : %llu\n", n,
- be64_to_cpu(vc->array_blocks)/2);
+ (unsigned long long)(be64_to_cpu(vc->array_blocks)/2));
}
}
@@ -1665,7 +1665,7 @@ static void examine_pds(struct ddf_super *sb)
printf(" %3d %08x ", i,
be32_to_cpu(pd->refnum));
printf("%8lluK ",
- be64_to_cpu(pd->config_size)>>1);
+ (unsigned long long)be64_to_cpu(pd->config_size)>>1);
for (dl = sb->dlist; dl ; dl = dl->next) {
if (be32_eq(dl->disk.refnum, pd->refnum)) {
char *dv = map_dev(dl->major, dl->minor, 0);
@@ -2901,7 +2901,8 @@ static unsigned int find_unused_pde(const struct ddf_super *ddf)
static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
{
__u64 cfs, t;
- cfs = min(dl->size - 32*1024*2ULL, be64_to_cpu(dl->primary_lba));
+ cfs = min((unsigned long long)dl->size - 32*1024*2ULL,
+ (unsigned long long)(be64_to_cpu(dl->primary_lba)));
t = be64_to_cpu(dl->secondary_lba);
if (t != ~(__u64)0)
cfs = min(cfs, t);
diff --git a/super-intel.c b/super-intel.c
index b7b030a20432..4fbbc98d915c 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2325,7 +2325,8 @@ static void export_examine_super_imsm(struct supertype *st)
printf("MD_LEVEL=container\n");
printf("MD_UUID=%s\n", nbuf+5);
printf("MD_DEVICES=%u\n", mpb->num_disks);
- printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time));
+ printf("MD_CREATION_TIME=%llu\n",
+ (unsigned long long)__le64_to_cpu(mpb->creation_time));
}
static void detail_super_imsm(struct supertype *st, char *homehost,
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] mdadm: add attribute nonstring for signature
2025-05-07 12:19 [PATCH 0/3] mdadm: minor fixes Xiao Ni
2025-05-07 12:20 ` [PATCH 1/3] mdadm: use standard libc nftw Xiao Ni
2025-05-07 12:20 ` [PATCH 2/3] mdadm: fix building errors Xiao Ni
@ 2025-05-07 12:20 ` Xiao Ni
2 siblings, 0 replies; 6+ messages in thread
From: Xiao Ni @ 2025-05-07 12:20 UTC (permalink / raw)
To: linux-raid; +Cc: mtkaczyk, ncroxon
It reports building error in f42:
error: initializer-string for array of ‘unsigned char’ truncates NULL
terminator but destination lacks ‘nonstring’ attribute (5 chars into 4
available) [-Werror=unterminated-string-initialization]
Signed-off-by: Xiao Ni <xni@redhat.com>
---
platform-intel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/platform-intel.h b/platform-intel.h
index 63d416826118..f92a9a11c3a0 100644
--- a/platform-intel.h
+++ b/platform-intel.h
@@ -24,7 +24,7 @@
/* The IMSM Capability (IMSM AHCI and ISCU OROM/EFI variable) Version Table definition */
struct imsm_orom {
- __u8 signature[4];
+ __u8 signature[4] __attribute__((nonstring));
#define IMSM_OROM_SIGNATURE "$VER"
#define IMSM_NVME_OROM_COMPAT_SIGNATURE "$NVM"
#define IMSM_VMD_OROM_COMPAT_SIGNATURE "$VMD"
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] mdadm: fix building errors
2025-05-07 12:20 ` [PATCH 2/3] mdadm: fix building errors Xiao Ni
@ 2025-05-07 13:53 ` Paul Menzel
2025-05-08 2:53 ` Xiao Ni
0 siblings, 1 reply; 6+ messages in thread
From: Paul Menzel @ 2025-05-07 13:53 UTC (permalink / raw)
To: Xiao Ni; +Cc: linux-raid, mtkaczyk, ncroxon
Dear Xiao,
Thank you for your patch. Could you make the summary/title more
specific? Something like Cast …?
Am 07.05.25 um 14:20 schrieb Xiao Ni:
> Some building errors are found in ppc64le platform:
> format '%llu' expects argument of type 'long long unsigned int', but
> argument 3 has type 'long unsigned int' [-Werror=format=]
I’d put pasted things in one line.
Also, please state how you fixed this.
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
> super-ddf.c | 9 +++++----
> super-intel.c | 3 ++-
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/super-ddf.c b/super-ddf.c
> index 6e7db924d2b1..dda8b7fedd64 100644
> --- a/super-ddf.c
> +++ b/super-ddf.c
> @@ -1606,9 +1606,9 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid)
> map_num(ddf_sec_level, vc->srl) ?: "-unknown-");
> }
> printf(" Device Size[%d] : %llu\n", n,
> - be64_to_cpu(vc->blocks)/2);
> + (unsigned long long)(be64_to_cpu(vc->blocks)/2));
> printf(" Array Size[%d] : %llu\n", n,
> - be64_to_cpu(vc->array_blocks)/2);
> + (unsigned long long)(be64_to_cpu(vc->array_blocks)/2));
> }
> }
>
> @@ -1665,7 +1665,7 @@ static void examine_pds(struct ddf_super *sb)
> printf(" %3d %08x ", i,
> be32_to_cpu(pd->refnum));
> printf("%8lluK ",
> - be64_to_cpu(pd->config_size)>>1);
> + (unsigned long long)be64_to_cpu(pd->config_size)>>1);
Keep the alignement from before?
> for (dl = sb->dlist; dl ; dl = dl->next) {
> if (be32_eq(dl->disk.refnum, pd->refnum)) {
> char *dv = map_dev(dl->major, dl->minor, 0);
> @@ -2901,7 +2901,8 @@ static unsigned int find_unused_pde(const struct ddf_super *ddf)
> static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
> {
> __u64 cfs, t;
> - cfs = min(dl->size - 32*1024*2ULL, be64_to_cpu(dl->primary_lba));
> + cfs = min((unsigned long long)dl->size - 32*1024*2ULL,
> + (unsigned long long)(be64_to_cpu(dl->primary_lba)));
> t = be64_to_cpu(dl->secondary_lba);
> if (t != ~(__u64)0)
> cfs = min(cfs, t);
> diff --git a/super-intel.c b/super-intel.c
> index b7b030a20432..4fbbc98d915c 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -2325,7 +2325,8 @@ static void export_examine_super_imsm(struct supertype *st)
> printf("MD_LEVEL=container\n");
> printf("MD_UUID=%s\n", nbuf+5);
> printf("MD_DEVICES=%u\n", mpb->num_disks);
> - printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time));
> + printf("MD_CREATION_TIME=%llu\n",
> + (unsigned long long)__le64_to_cpu(mpb->creation_time));
> }
>
> static void detail_super_imsm(struct supertype *st, char *homehost,
Can’t this be fixed in the header?
Kind regards,
Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] mdadm: fix building errors
2025-05-07 13:53 ` Paul Menzel
@ 2025-05-08 2:53 ` Xiao Ni
0 siblings, 0 replies; 6+ messages in thread
From: Xiao Ni @ 2025-05-08 2:53 UTC (permalink / raw)
To: Paul Menzel; +Cc: linux-raid, mtkaczyk, ncroxon
On Wed, May 7, 2025 at 9:53 PM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Xiao,
>
>
> Thank you for your patch. Could you make the summary/title more
> specific? Something like Cast …?
How about 'Cast be64_to_cpu to unsigned long long'? Or any good suggestion?
>
>
> Am 07.05.25 um 14:20 schrieb Xiao Ni:
> > Some building errors are found in ppc64le platform:
> > format '%llu' expects argument of type 'long long unsigned int', but
> > argument 3 has type 'long unsigned int' [-Werror=format=]
>
> I’d put pasted things in one line.
There is a 75 character number limit for each line in commit.
>
> Also, please state how you fixed this.
Ok, but it's easy to see from the patch. It just do a cast with
(unsigned long long)
>
> > Signed-off-by: Xiao Ni <xni@redhat.com>
> > ---
> > super-ddf.c | 9 +++++----
> > super-intel.c | 3 ++-
> > 2 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/super-ddf.c b/super-ddf.c
> > index 6e7db924d2b1..dda8b7fedd64 100644
> > --- a/super-ddf.c
> > +++ b/super-ddf.c
> > @@ -1606,9 +1606,9 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid)
> > map_num(ddf_sec_level, vc->srl) ?: "-unknown-");
> > }
> > printf(" Device Size[%d] : %llu\n", n,
> > - be64_to_cpu(vc->blocks)/2);
> > + (unsigned long long)(be64_to_cpu(vc->blocks)/2));
> > printf(" Array Size[%d] : %llu\n", n,
> > - be64_to_cpu(vc->array_blocks)/2);
> > + (unsigned long long)(be64_to_cpu(vc->array_blocks)/2));
> > }
> > }
> >
> > @@ -1665,7 +1665,7 @@ static void examine_pds(struct ddf_super *sb)
> > printf(" %3d %08x ", i,
> > be32_to_cpu(pd->refnum));
> > printf("%8lluK ",
> > - be64_to_cpu(pd->config_size)>>1);
> > + (unsigned long long)be64_to_cpu(pd->config_size)>>1);
>
> Keep the alignement from before?
We usually use tab rather than spaces. So it's better to use tab here.
But I don't want to fix all the alignments problem.
>
> > for (dl = sb->dlist; dl ; dl = dl->next) {
> > if (be32_eq(dl->disk.refnum, pd->refnum)) {
> > char *dv = map_dev(dl->major, dl->minor, 0);
> > @@ -2901,7 +2901,8 @@ static unsigned int find_unused_pde(const struct ddf_super *ddf)
> > static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
> > {
> > __u64 cfs, t;
> > - cfs = min(dl->size - 32*1024*2ULL, be64_to_cpu(dl->primary_lba));
> > + cfs = min((unsigned long long)dl->size - 32*1024*2ULL,
> > + (unsigned long long)(be64_to_cpu(dl->primary_lba)));
> > t = be64_to_cpu(dl->secondary_lba);
> > if (t != ~(__u64)0)
> > cfs = min(cfs, t);
> > diff --git a/super-intel.c b/super-intel.c
> > index b7b030a20432..4fbbc98d915c 100644
> > --- a/super-intel.c
> > +++ b/super-intel.c
> > @@ -2325,7 +2325,8 @@ static void export_examine_super_imsm(struct supertype *st)
> > printf("MD_LEVEL=container\n");
> > printf("MD_UUID=%s\n", nbuf+5);
> > printf("MD_DEVICES=%u\n", mpb->num_disks);
> > - printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time));
> > + printf("MD_CREATION_TIME=%llu\n",
> > + (unsigned long long)__le64_to_cpu(mpb->creation_time));
> > }
> >
> > static void detail_super_imsm(struct supertype *st, char *homehost,
>
> Can’t this be fixed in the header?
I don't follow you here.
Best Regards
Xiao
>
>
> Kind regards,
>
> Paul
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-08 2:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 12:19 [PATCH 0/3] mdadm: minor fixes Xiao Ni
2025-05-07 12:20 ` [PATCH 1/3] mdadm: use standard libc nftw Xiao Ni
2025-05-07 12:20 ` [PATCH 2/3] mdadm: fix building errors Xiao Ni
2025-05-07 13:53 ` Paul Menzel
2025-05-08 2:53 ` Xiao Ni
2025-05-07 12:20 ` [PATCH 3/3] mdadm: add attribute nonstring for signature Xiao Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).