* [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
@ 2025-10-22 11:44 John Paul Adrian Glaubitz
2025-10-22 11:44 ` [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits() John Paul Adrian Glaubitz
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-10-22 11:44 UTC (permalink / raw)
To: kexec; +Cc: Khalid Aziz, John Paul Adrian Glaubitz
Fixes the following build error on 32-bit PowerPC:
kexec/arch/ppc/fs2dt.c: In function 'putnode':
kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
| ^~~~~~~~~~~
| |
| int (*)(const void *, const void *)
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
kexec/arch/ppc/fs2dt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
index fed499b..d03b995 100644
--- a/kexec/arch/ppc/fs2dt.c
+++ b/kexec/arch/ppc/fs2dt.c
@@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
* Compare function used to sort the device-tree directories
* This function will be passed to scandir.
*/
-static int comparefunc(const void *dentry1, const void *dentry2)
+static int comparefunc(const struct dirent **dentry1,
+ const struct dirent **dentry2)
{
char *str1 = (*(struct dirent **)dentry1)->d_name;
char *str2 = (*(struct dirent **)dentry2)->d_name;
--
2.47.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits()
2025-10-22 11:44 [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() John Paul Adrian Glaubitz
@ 2025-10-22 11:44 ` John Paul Adrian Glaubitz
2025-10-22 15:15 ` [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() Khalid Aziz
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-10-22 11:44 UTC (permalink / raw)
To: kexec; +Cc: Khalid Aziz, John Paul Adrian Glaubitz
Fixes the following two build errors on 32-bit PowerPC:
kexec/arch/ppc/kexec-ppc.c: In function 'read_memory_region_limits':
kexec/arch/ppc/kexec-ppc.c:106:11: error: assignment to 'long long unsigned int *' from incompatible pointer type 'long unsigned int *' [-Wincompatible-pointer-types]
106 | p = (unsigned long*)buf;
| ^
kexec/arch/ppc/kexec-ppc.c: In function 'read_memory_region_limits':
kexec/arch/ppc/kexec-ppc.c:112:19: error: assignment to 'long unsigned int *' from incompatible pointer type 'long long unsigned int *' [-Wincompatible-pointer-types]
112 | p = (unsigned long long *)p + 1;
| ^
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
kexec/arch/ppc/kexec-ppc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index d3dad0f..e173433 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -91,7 +91,7 @@ int read_memory_region_limits(int fd, unsigned long long *start,
unsigned long long *end)
{
char buf[MAXBYTES];
- unsigned long *p;
+ unsigned long long *p;
unsigned long nbytes = dt_address_cells + dt_size_cells;
if (lseek(fd, 0, SEEK_SET) == -1) {
@@ -103,7 +103,7 @@ int read_memory_region_limits(int fd, unsigned long long *start,
return -1;
}
- p = (unsigned long*)buf;
+ p = (unsigned long long*)buf;
if (dt_address_cells == sizeof(unsigned long)) {
*start = p[0];
p++;
--
2.47.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-10-22 11:44 [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() John Paul Adrian Glaubitz
2025-10-22 11:44 ` [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits() John Paul Adrian Glaubitz
@ 2025-10-22 15:15 ` Khalid Aziz
2025-10-22 15:20 ` John Paul Adrian Glaubitz
2025-11-11 13:31 ` Simon Horman
2025-11-22 11:11 ` John Paul Adrian Glaubitz
3 siblings, 1 reply; 8+ messages in thread
From: Khalid Aziz @ 2025-10-22 15:15 UTC (permalink / raw)
To: John Paul Adrian Glaubitz, kexec
On 10/22/25 5:44 AM, John Paul Adrian Glaubitz wrote:
> Fixes the following build error on 32-bit PowerPC:
>
> kexec/arch/ppc/fs2dt.c: In function 'putnode':
> kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
> 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
> | ^~~~~~~~~~~
> | |
> | int (*)(const void *, const void *)
>
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
I sent out a suggested patch yesterday making these same changes. They make sense to me.
> ---
> kexec/arch/ppc/fs2dt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
> index fed499b..d03b995 100644
> --- a/kexec/arch/ppc/fs2dt.c
> +++ b/kexec/arch/ppc/fs2dt.c
> @@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
> * Compare function used to sort the device-tree directories
> * This function will be passed to scandir.
> */
> -static int comparefunc(const void *dentry1, const void *dentry2)
> +static int comparefunc(const struct dirent **dentry1,
> + const struct dirent **dentry2)
> {
> char *str1 = (*(struct dirent **)dentry1)->d_name;
> char *str2 = (*(struct dirent **)dentry2)->d_name;
You can drop typecasting in above two lines as well:
- char *str1 = (*(struct dirent **)dentry1)->d_name;
- char *str2 = (*(struct dirent **)dentry2)->d_name;
+ char *str1 = (*dentry1)->d_name;
+ char *str2 = (*dentry2)->d_name;
--
Khalid
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-10-22 15:15 ` [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() Khalid Aziz
@ 2025-10-22 15:20 ` John Paul Adrian Glaubitz
2025-10-22 15:32 ` Khalid Aziz
0 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-10-22 15:20 UTC (permalink / raw)
To: khalid; +Cc: kexec
Hi Khalid,
On Wed, 2025-10-22 at 09:15 -0600, Khalid Aziz wrote:
> On 10/22/25 5:44 AM, John Paul Adrian Glaubitz wrote:
> > Fixes the following build error on 32-bit PowerPC:
> >
> > kexec/arch/ppc/fs2dt.c: In function 'putnode':
> > kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
> > 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
> > | ^~~~~~~~~~~
> > | |
> > | int (*)(const void *, const void *)
> >
> > Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>
> I sent out a suggested patch yesterday making these same changes. They make sense to me.
Yes, I actually saw your patch after submitting my patches. ;-)
> > ---
> > kexec/arch/ppc/fs2dt.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
> > index fed499b..d03b995 100644
> > --- a/kexec/arch/ppc/fs2dt.c
> > +++ b/kexec/arch/ppc/fs2dt.c
> > @@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
> > * Compare function used to sort the device-tree directories
> > * This function will be passed to scandir.
> > */
> > -static int comparefunc(const void *dentry1, const void *dentry2)
> > +static int comparefunc(const struct dirent **dentry1,
> > + const struct dirent **dentry2)
> > {
> > char *str1 = (*(struct dirent **)dentry1)->d_name;
> > char *str2 = (*(struct dirent **)dentry2)->d_name;
>
> You can drop typecasting in above two lines as well:
>
> - char *str1 = (*(struct dirent **)dentry1)->d_name;
> - char *str2 = (*(struct dirent **)dentry2)->d_name;
> + char *str1 = (*dentry1)->d_name;
> + char *str2 = (*dentry2)->d_name;
That's right. However, that should be done in a separate patch which would
also do the same for comparefunc() in kexec/fs2dt.c so that changes that
logically belong together are submitted as one patch.
My changes above are the minimal changes required to fix the build on 32-bit
PowerPC which I tested on the Debian powerpc/ppc64 porterbox.
Once the two patches are merged, I'm happy to submit one to drop the two
type-casting changes in both instances of comparefunc().
There are also some warnings that I will look into and address them.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-10-22 15:20 ` John Paul Adrian Glaubitz
@ 2025-10-22 15:32 ` Khalid Aziz
0 siblings, 0 replies; 8+ messages in thread
From: Khalid Aziz @ 2025-10-22 15:32 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: kexec
On 10/22/25 9:20 AM, John Paul Adrian Glaubitz wrote:
> Hi Khalid,
>
> On Wed, 2025-10-22 at 09:15 -0600, Khalid Aziz wrote:
>> On 10/22/25 5:44 AM, John Paul Adrian Glaubitz wrote:
>>> Fixes the following build error on 32-bit PowerPC:
>>>
>>> kexec/arch/ppc/fs2dt.c: In function 'putnode':
>>> kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
>>> 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
>>> | ^~~~~~~~~~~
>>> | |
>>> | int (*)(const void *, const void *)
>>>
>>> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>>
>> I sent out a suggested patch yesterday making these same changes. They make sense to me.
>
> Yes, I actually saw your patch after submitting my patches. ;-)
>
>>> ---
>>> kexec/arch/ppc/fs2dt.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
>>> index fed499b..d03b995 100644
>>> --- a/kexec/arch/ppc/fs2dt.c
>>> +++ b/kexec/arch/ppc/fs2dt.c
>>> @@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
>>> * Compare function used to sort the device-tree directories
>>> * This function will be passed to scandir.
>>> */
>>> -static int comparefunc(const void *dentry1, const void *dentry2)
>>> +static int comparefunc(const struct dirent **dentry1,
>>> + const struct dirent **dentry2)
>>> {
>>> char *str1 = (*(struct dirent **)dentry1)->d_name;
>>> char *str2 = (*(struct dirent **)dentry2)->d_name;
>>
>> You can drop typecasting in above two lines as well:
>>
>> - char *str1 = (*(struct dirent **)dentry1)->d_name;
>> - char *str2 = (*(struct dirent **)dentry2)->d_name;
>> + char *str1 = (*dentry1)->d_name;
>> + char *str2 = (*dentry2)->d_name;
>
> That's right. However, that should be done in a separate patch which would
> also do the same for comparefunc() in kexec/fs2dt.c so that changes that
> logically belong together are submitted as one patch.
Okay, I can see that. It also makes sense to drop typecast in kexec/arch/ppc/kexec-ppc.c
in the same patch that changes comparefunc declaration. I don't feel strongly about
either approach and can go either way. You can add my reviewed by tag:
Reviewed-by: Khalid Aziz <khalid@gonehiking.org>
>
> My changes above are the minimal changes required to fix the build on 32-bit
> PowerPC which I tested on the Debian powerpc/ppc64 porterbox.
>
> Once the two patches are merged, I'm happy to submit one to drop the two
> type-casting changes in both instances of comparefunc().
>
> There are also some warnings that I will look into and address them.
Yes, there are lots of build warnings :) I chose to ignore those for now and get
this building first. I am glad you are looking at those.
>
> Adrian
>
--Khalid
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-10-22 11:44 [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() John Paul Adrian Glaubitz
2025-10-22 11:44 ` [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits() John Paul Adrian Glaubitz
2025-10-22 15:15 ` [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() Khalid Aziz
@ 2025-11-11 13:31 ` Simon Horman
2025-11-22 11:11 ` John Paul Adrian Glaubitz
3 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-11-11 13:31 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: kexec, Khalid Aziz
On Wed, Oct 22, 2025 at 01:44:12PM +0200, John Paul Adrian Glaubitz wrote:
> Fixes the following build error on 32-bit PowerPC:
>
> kexec/arch/ppc/fs2dt.c: In function 'putnode':
> kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
> 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
> | ^~~~~~~~~~~
> | |
> | int (*)(const void *, const void *)
>
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Thanks,
I was able to reproduce this using gcc-powerpc-linux-gnu 4:14.2.0-1
on Debian Trixie. Likewise for patch 2/2.
There is a CI workflow that exercises 32-bit PowerPC builds [1].
However, it does not exhibit the problems reported.
I guess that is because it is using an older GCC,
gcc-powerpc-linux-gnu 4:13.2.0-7ubuntu1 on Ubuntu 24.04.
[1] https://github.com/horms/kexec-tools/actions/runs/18554906205/job/52889935741
It would be nice to update the job,
but perhaps that is something that comes with Ubuntu 26.04.
In any case I have applied this series:
- kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=6c878e9b8a50
- kexec-tools: powerpc: Fix function signature of comparefunc()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=2786f8eb3e5e
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-10-22 11:44 [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() John Paul Adrian Glaubitz
` (2 preceding siblings ...)
2025-11-11 13:31 ` Simon Horman
@ 2025-11-22 11:11 ` John Paul Adrian Glaubitz
2025-12-03 17:24 ` Simon Horman
3 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-11-22 11:11 UTC (permalink / raw)
To: kexec; +Cc: Khalid Aziz
On Wed, 2025-10-22 at 13:44 +0200, John Paul Adrian Glaubitz wrote:
> Fixes the following build error on 32-bit PowerPC:
>
> kexec/arch/ppc/fs2dt.c: In function 'putnode':
> kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
> 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
> | ^~~~~~~~~~~
> | |
> | int (*)(const void *, const void *)
>
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> ---
> kexec/arch/ppc/fs2dt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
> index fed499b..d03b995 100644
> --- a/kexec/arch/ppc/fs2dt.c
> +++ b/kexec/arch/ppc/fs2dt.c
> @@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
> * Compare function used to sort the device-tree directories
> * This function will be passed to scandir.
> */
> -static int comparefunc(const void *dentry1, const void *dentry2)
> +static int comparefunc(const struct dirent **dentry1,
> + const struct dirent **dentry2)
> {
> char *str1 = (*(struct dirent **)dentry1)->d_name;
> char *str2 = (*(struct dirent **)dentry2)->d_name;
Ping for both patches.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc()
2025-11-22 11:11 ` John Paul Adrian Glaubitz
@ 2025-12-03 17:24 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-12-03 17:24 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: kexec, Khalid Aziz
On Sat, Nov 22, 2025 at 12:11:47PM +0100, John Paul Adrian Glaubitz wrote:
> On Wed, 2025-10-22 at 13:44 +0200, John Paul Adrian Glaubitz wrote:
> > Fixes the following build error on 32-bit PowerPC:
> >
> > kexec/arch/ppc/fs2dt.c: In function 'putnode':
> > kexec/arch/ppc/fs2dt.c:338:51: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
> > 338 | numlist = scandir(pathname, &namelist, 0, comparefunc);
> > | ^~~~~~~~~~~
> > | |
> > | int (*)(const void *, const void *)
> >
> > Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > ---
> > kexec/arch/ppc/fs2dt.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
> > index fed499b..d03b995 100644
> > --- a/kexec/arch/ppc/fs2dt.c
> > +++ b/kexec/arch/ppc/fs2dt.c
> > @@ -292,7 +292,8 @@ static void putprops(char *fn, struct dirent **nlist, int numlist)
> > * Compare function used to sort the device-tree directories
> > * This function will be passed to scandir.
> > */
> > -static int comparefunc(const void *dentry1, const void *dentry2)
> > +static int comparefunc(const struct dirent **dentry1,
> > + const struct dirent **dentry2)
> > {
> > char *str1 = (*(struct dirent **)dentry1)->d_name;
> > char *str2 = (*(struct dirent **)dentry2)->d_name;
>
> Ping for both patches.
Perhaps this email [1] got lost somehow?
[1] https://lore.kernel.org/kexec/aRM6sOfZdcyB-2j3@horms.kernel.org/
FTR, they have been applied as:
- kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=6c878e9b8a50
- kexec-tools: powerpc: Fix function signature of comparefunc()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=2786f8eb3e5e
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-12-03 17:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 11:44 [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() John Paul Adrian Glaubitz
2025-10-22 11:44 ` [PATCH 2/2] kexec-tools: powerpc: Fix pointer declarations in read_memory_region_limits() John Paul Adrian Glaubitz
2025-10-22 15:15 ` [Spam] [PATCH 1/2] kexec-tools: powerpc: Fix function signature of comparefunc() Khalid Aziz
2025-10-22 15:20 ` John Paul Adrian Glaubitz
2025-10-22 15:32 ` Khalid Aziz
2025-11-11 13:31 ` Simon Horman
2025-11-22 11:11 ` John Paul Adrian Glaubitz
2025-12-03 17:24 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox