* [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
@ 2020-12-15 18:56 Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 8+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-15 18:56 UTC (permalink / raw)
To: linux-kernel; +Cc: luto, tglx, mingo, bp, x86, hpa
Fixing the following compiler warning by explicit conversion to long:
In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
^
CC mm/filemap.o
In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
changes v2: using %zu instead of %lu, which is the preferred conversion
for size_t - the line break isn't needed anymore
---
arch/x86/entry/vdso/vdso2c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index 1c7cfac7e64a..5264daa8859f 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -35,7 +35,7 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
if (offset + len > data_len)
fail("section to extract overruns input data");
- fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
+ fprintf(outfile, "static const unsigned char %s[%zu] = {", name, len);
BITSFUNC(copy)(outfile, data + offset, len);
fprintf(outfile, "\n};\n\n");
}
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:55 ` Andy Lutomirski
@ 2020-12-15 18:55 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 8+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-15 18:55 UTC (permalink / raw)
To: Andy Lutomirski, Randy Dunlap
Cc: Enrico Weigelt, metux IT consult, LKML, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, X86 ML, H. Peter Anvin
On 15.12.20 17:55, Andy Lutomirski wrote:
>>>> size_t is normally printed with %zu.
>>>> Is there some reason that isn't being used here?
>>>
>>> No. Want to send a patch?
>>>
>>
>> I was hoping that Enrico would fix this and maybe address your other comment,
>> although I'm not so sure that I agree with it.
>
> Using %zu would get rid of the line break entirely. Enrico?
you're both rigth. I'll send a v2 of the patch
--mtx
--
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:42 ` Randy Dunlap
@ 2020-12-15 16:55 ` Andy Lutomirski
2020-12-15 18:55 ` Enrico Weigelt, metux IT consult
0 siblings, 1 reply; 8+ messages in thread
From: Andy Lutomirski @ 2020-12-15 16:55 UTC (permalink / raw)
To: Randy Dunlap
Cc: Andy Lutomirski, Enrico Weigelt, metux IT consult, LKML,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, X86 ML,
H. Peter Anvin
On Tue, Dec 15, 2020 at 8:42 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 12/15/20 8:39 AM, Andy Lutomirski wrote:
> > On Tue, Dec 15, 2020 at 8:32 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> On 12/15/20 8:03 AM, Enrico Weigelt, metux IT consult wrote:
> >>> Fixing the following compiler warning by explicit conversion to long:
> >>>
> >>> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
> >>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> >>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> >>> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> >>> ^
> >>> CC mm/filemap.o
> >>> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
> >>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
> >>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> >>> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> >>>
> >>> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> >>> ---
> >>> arch/x86/entry/vdso/vdso2c.h | 3 ++-
> >>> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> Hi,
> >>
> >> size_t is normally printed with %zu.
> >> Is there some reason that isn't being used here?
> >
> > No. Want to send a patch?
> >
>
> I was hoping that Enrico would fix this and maybe address your other comment,
> although I'm not so sure that I agree with it.
Using %zu would get rid of the line break entirely. Enrico?
>
> --
> ~Randy
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:39 ` Andy Lutomirski
@ 2020-12-15 16:42 ` Randy Dunlap
2020-12-15 16:55 ` Andy Lutomirski
0 siblings, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2020-12-15 16:42 UTC (permalink / raw)
To: Andy Lutomirski
Cc: Enrico Weigelt, metux IT consult, LKML, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, X86 ML, H. Peter Anvin
On 12/15/20 8:39 AM, Andy Lutomirski wrote:
> On Tue, Dec 15, 2020 at 8:32 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> On 12/15/20 8:03 AM, Enrico Weigelt, metux IT consult wrote:
>>> Fixing the following compiler warning by explicit conversion to long:
>>>
>>> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
>>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
>>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
>>> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>>> ^
>>> CC mm/filemap.o
>>> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
>>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
>>> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
>>> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>>>
>>> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
>>> ---
>>> arch/x86/entry/vdso/vdso2c.h | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Hi,
>>
>> size_t is normally printed with %zu.
>> Is there some reason that isn't being used here?
>
> No. Want to send a patch?
>
I was hoping that Enrico would fix this and maybe address your other comment,
although I'm not so sure that I agree with it.
--
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:32 ` Randy Dunlap
@ 2020-12-15 16:39 ` Andy Lutomirski
2020-12-15 16:42 ` Randy Dunlap
0 siblings, 1 reply; 8+ messages in thread
From: Andy Lutomirski @ 2020-12-15 16:39 UTC (permalink / raw)
To: Randy Dunlap
Cc: Enrico Weigelt, metux IT consult, LKML, Andrew Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, X86 ML,
H. Peter Anvin
On Tue, Dec 15, 2020 at 8:32 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 12/15/20 8:03 AM, Enrico Weigelt, metux IT consult wrote:
> > Fixing the following compiler warning by explicit conversion to long:
> >
> > In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
> > /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> > /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> > fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> > ^
> > CC mm/filemap.o
> > In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
> > /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
> > /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> > fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> >
> > Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> > ---
> > arch/x86/entry/vdso/vdso2c.h | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Hi,
>
> size_t is normally printed with %zu.
> Is there some reason that isn't being used here?
No. Want to send a patch?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:03 Enrico Weigelt, metux IT consult
2020-12-15 16:15 ` Andy Lutomirski
@ 2020-12-15 16:32 ` Randy Dunlap
2020-12-15 16:39 ` Andy Lutomirski
1 sibling, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2020-12-15 16:32 UTC (permalink / raw)
To: Enrico Weigelt, metux IT consult, linux-kernel
Cc: luto, tglx, mingo, bp, x86, hpa
On 12/15/20 8:03 AM, Enrico Weigelt, metux IT consult wrote:
> Fixing the following compiler warning by explicit conversion to long:
>
> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> ^
> CC mm/filemap.o
> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ---
> arch/x86/entry/vdso/vdso2c.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Hi,
size_t is normally printed with %zu.
Is there some reason that isn't being used here?
> diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
> index 1c7cfac7e64a..5c6a4bbc63f9 100644
> --- a/arch/x86/entry/vdso/vdso2c.h
> +++ b/arch/x86/entry/vdso/vdso2c.h
> @@ -35,7 +35,8 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
> if (offset + len > data_len)
> fail("section to extract overruns input data");
>
> - fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> + fprintf(outfile, "static const unsigned char %s[%lu] = {", name,
> + (unsigned long)len);
> BITSFUNC(copy)(outfile, data + offset, len);
> fprintf(outfile, "\n};\n\n");
> }
>
thanks.
--
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
2020-12-15 16:03 Enrico Weigelt, metux IT consult
@ 2020-12-15 16:15 ` Andy Lutomirski
2020-12-15 16:32 ` Randy Dunlap
1 sibling, 0 replies; 8+ messages in thread
From: Andy Lutomirski @ 2020-12-15 16:15 UTC (permalink / raw)
To: Enrico Weigelt, metux IT consult
Cc: LKML, Andrew Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, X86 ML, H. Peter Anvin
On Tue, Dec 15, 2020 at 8:03 AM Enrico Weigelt, metux IT consult
<info@metux.net> wrote:
>
> Fixing the following compiler warning by explicit conversion to long:
>
> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> ^
> CC mm/filemap.o
> In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
> fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ---
> arch/x86/entry/vdso/vdso2c.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
> index 1c7cfac7e64a..5c6a4bbc63f9 100644
> --- a/arch/x86/entry/vdso/vdso2c.h
> +++ b/arch/x86/entry/vdso/vdso2c.h
> @@ -35,7 +35,8 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
> if (offset + len > data_len)
> fail("section to extract overruns input data");
>
> - fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
> + fprintf(outfile, "static const unsigned char %s[%lu] = {", name,
> + (unsigned long)len);
This would be nicer if you put the line break after the equal sign and
before the {.
--Andy
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call
@ 2020-12-15 16:03 Enrico Weigelt, metux IT consult
2020-12-15 16:15 ` Andy Lutomirski
2020-12-15 16:32 ` Randy Dunlap
0 siblings, 2 replies; 8+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-15 16:03 UTC (permalink / raw)
To: linux-kernel; +Cc: luto, tglx, mingo, bp, x86, hpa
Fixing the following compiler warning by explicit conversion to long:
In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:162:0:
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
^
CC mm/filemap.o
In file included from /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.c:166:0:
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h: In function 'extract32':
/home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/x86/entry/vdso/vdso2c.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h
index 1c7cfac7e64a..5c6a4bbc63f9 100644
--- a/arch/x86/entry/vdso/vdso2c.h
+++ b/arch/x86/entry/vdso/vdso2c.h
@@ -35,7 +35,8 @@ static void BITSFUNC(extract)(const unsigned char *data, size_t data_len,
if (offset + len > data_len)
fail("section to extract overruns input data");
- fprintf(outfile, "static const unsigned char %s[%lu] = {", name, len);
+ fprintf(outfile, "static const unsigned char %s[%lu] = {", name,
+ (unsigned long)len);
BITSFUNC(copy)(outfile, data + offset, len);
fprintf(outfile, "\n};\n\n");
}
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-12-15 18:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 18:56 [PATCH] arch: x86: entry: vdso: fix type conversion on printf() call Enrico Weigelt, metux IT consult
-- strict thread matches above, loose matches on Subject: below --
2020-12-15 16:03 Enrico Weigelt, metux IT consult
2020-12-15 16:15 ` Andy Lutomirski
2020-12-15 16:32 ` Randy Dunlap
2020-12-15 16:39 ` Andy Lutomirski
2020-12-15 16:42 ` Randy Dunlap
2020-12-15 16:55 ` Andy Lutomirski
2020-12-15 18:55 ` Enrico Weigelt, metux IT consult
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).