linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/vdso: fix a warning with x32 compiler
@ 2021-01-23 10:50 Mikulas Patocka
  2021-01-25 17:14 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2021-01-23 10:50 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Andy Lutomirski, Jarkko Sakkinen, Borislav Petkov,
	Jethro Beekman, x86, linux-sgx

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1242 bytes --]

This patch fixes a warning:
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=]
when compiling the kernel with x32 compiler.

The reason for the warning is that in x32 mode, size_t is defined as
unsigned, not unsigned long.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")

---
 arch/x86/entry/vdso/vdso2c.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/entry/vdso/vdso2c.h
===================================================================
--- linux-2.6.orig/arch/x86/entry/vdso/vdso2c.h	2021-01-07 17:22:39.000000000 +0100
+++ linux-2.6/arch/x86/entry/vdso/vdso2c.h	2021-01-23 10:44:09.000000000 +0100
@@ -27,10 +27,10 @@ static void BITSFUNC(extract)(const unsi
 			      FILE *outfile, ELF(Shdr) *sec, const char *name)
 {
 	unsigned long offset;
-	size_t len;
+	unsigned long len;
 
 	offset = (unsigned long)GET_LE(&sec->sh_offset);
-	len = (size_t)GET_LE(&sec->sh_size);
+	len = GET_LE(&sec->sh_size);
 
 	if (offset + len > data_len)
 		fail("section to extract overruns input data");

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/vdso: fix a warning with x32 compiler
  2021-01-23 10:50 [PATCH] x86/vdso: fix a warning with x32 compiler Mikulas Patocka
@ 2021-01-25 17:14 ` Jarkko Sakkinen
  2021-01-25 17:26   ` Mikulas Patocka
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2021-01-25 17:14 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Sean Christopherson, Andy Lutomirski, Borislav Petkov,
	Jethro Beekman, x86, linux-sgx

On Sat, Jan 23, 2021 at 05:50:31AM -0500, Mikulas Patocka wrote:
> This patch fixes a warning:
> 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=]
> when compiling the kernel with x32 compiler.
> 
> The reason for the warning is that in x32 mode, size_t is defined as
> unsigned, not unsigned long.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")

So... Why not %zu?

/Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/vdso: fix a warning with x32 compiler
  2021-01-25 17:14 ` Jarkko Sakkinen
@ 2021-01-25 17:26   ` Mikulas Patocka
  0 siblings, 0 replies; 3+ messages in thread
From: Mikulas Patocka @ 2021-01-25 17:26 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Sean Christopherson, Andy Lutomirski, Borislav Petkov,
	Jethro Beekman, x86, linux-sgx

[-- Attachment #1: Type: TEXT/PLAIN, Size: 804 bytes --]



On Mon, 25 Jan 2021, Jarkko Sakkinen wrote:

> On Sat, Jan 23, 2021 at 05:50:31AM -0500, Mikulas Patocka wrote:
> > This patch fixes a warning:
> > 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=]
> > when compiling the kernel with x32 compiler.
> > 
> > The reason for the warning is that in x32 mode, size_t is defined as
> > unsigned, not unsigned long.
> > 
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > Fixes: 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO functions")
> 
> So... Why not %zu?
> 
> /Jarkko

You can use %zu - it doesn't matter, size_t has the same size as unsigned 
long on all supported architectures.

Mikulas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-25 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 10:50 [PATCH] x86/vdso: fix a warning with x32 compiler Mikulas Patocka
2021-01-25 17:14 ` Jarkko Sakkinen
2021-01-25 17:26   ` Mikulas Patocka

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).