All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
@ 2012-12-22 10:23 Stefan Hasko
       [not found] ` <1356171805-16930-1-git-send-email-hasko.stevo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hasko @ 2012-12-22 10:23 UTC (permalink / raw)
  To: Matt Fleming, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86
  Cc: linux-efi, linux-kernel, Stefan Hasko

Fixed different size cast warnings in function setup_efi_pci

Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
---
 arch/x86/boot/compressed/eboot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b1942e2..dd99fca 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
 	int i;
 	struct setup_data *data;
 
-	data = (struct setup_data *)params->hdr.setup_data;
+	data = (struct setup_data *)(uintptr_t)params->hdr.setup_data;
 
 	while (data && data->next)
-		data = (struct setup_data *)data->next;
+		data = (struct setup_data *)(uintptr_t)data->next;
 
 	status = efi_call_phys5(sys_table->boottime->locate_handle,
 				EFI_LOCATE_BY_PROTOCOL, &pci_proto,
@@ -345,9 +345,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
 		memcpy(rom->romdata, pci->romimage, pci->romsize);
 
 		if (data)
-			data->next = (uint64_t)rom;
+			data->next = (uintptr_t)rom;
 		else
-			params->hdr.setup_data = (uint64_t)rom;
+			params->hdr.setup_data = (uintptr_t)rom;
 
 		data = (struct setup_data *)rom;
 
-- 
1.7.10.4

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

* Re: [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
  2012-12-22 10:23 [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms Stefan Hasko
@ 2012-12-26  8:00     ` Borislav Petkov
  0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2012-12-26  8:00 UTC (permalink / raw)
  To: Stefan Hasko
  Cc: Matt Fleming, H. Peter Anvin, Thomas Gleixner, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sat, Dec 22, 2012 at 11:23:25AM +0100, Stefan Hasko wrote:
> Fixed different size cast warnings in function setup_efi_pci
> 
> Signed-off-by: Stefan Hasko <hasko.stevo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

You might want to add the actual compiler warnings to the commit
message:

arch/x86/boot/compressed/eboot.c: In function ‘setup_efi_pci’:
arch/x86/boot/compressed/eboot.c:259:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
arch/x86/boot/compressed/eboot.c:262:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
arch/x86/boot/compressed/eboot.c:348:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
arch/x86/boot/compressed/eboot.c:350:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

And yes, I see them in all{mod,yes}config builds here too. The issue,
AFAICT, is that setup_data is __u64 to obviously accomodate 8-byte
pointers on x86-64 but on 32-bit they're half the size. And we obviously
cannot change struct setup_data since this is an ABI so I'd guess the
casts to native pointer sizes are ok. So

Acked-by: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>

> ---
>  arch/x86/boot/compressed/eboot.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index b1942e2..dd99fca 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
>  	int i;
>  	struct setup_data *data;
>  
> -	data = (struct setup_data *)params->hdr.setup_data;
> +	data = (struct setup_data *)(uintptr_t)params->hdr.setup_data;
>  
>  	while (data && data->next)
> -		data = (struct setup_data *)data->next;
> +		data = (struct setup_data *)(uintptr_t)data->next;
>  
>  	status = efi_call_phys5(sys_table->boottime->locate_handle,
>  				EFI_LOCATE_BY_PROTOCOL, &pci_proto,
> @@ -345,9 +345,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
>  		memcpy(rom->romdata, pci->romimage, pci->romsize);
>  
>  		if (data)
> -			data->next = (uint64_t)rom;
> +			data->next = (uintptr_t)rom;
>  		else
> -			params->hdr.setup_data = (uint64_t)rom;
> +			params->hdr.setup_data = (uintptr_t)rom;
>  
>  		data = (struct setup_data *)rom;
>  
> -- 
> 1.7.10.4

Thanks.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

* Re: [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
@ 2012-12-26  8:00     ` Borislav Petkov
  0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2012-12-26  8:00 UTC (permalink / raw)
  To: Stefan Hasko
  Cc: Matt Fleming, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86,
	linux-efi, linux-kernel

On Sat, Dec 22, 2012 at 11:23:25AM +0100, Stefan Hasko wrote:
> Fixed different size cast warnings in function setup_efi_pci
> 
> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>

You might want to add the actual compiler warnings to the commit
message:

arch/x86/boot/compressed/eboot.c: In function ‘setup_efi_pci’:
arch/x86/boot/compressed/eboot.c:259:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
arch/x86/boot/compressed/eboot.c:262:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
arch/x86/boot/compressed/eboot.c:348:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
arch/x86/boot/compressed/eboot.c:350:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

And yes, I see them in all{mod,yes}config builds here too. The issue,
AFAICT, is that setup_data is __u64 to obviously accomodate 8-byte
pointers on x86-64 but on 32-bit they're half the size. And we obviously
cannot change struct setup_data since this is an ABI so I'd guess the
casts to native pointer sizes are ok. So

Acked-by: Borislav Petkov <bp@alien8.de>

> ---
>  arch/x86/boot/compressed/eboot.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index b1942e2..dd99fca 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
>  	int i;
>  	struct setup_data *data;
>  
> -	data = (struct setup_data *)params->hdr.setup_data;
> +	data = (struct setup_data *)(uintptr_t)params->hdr.setup_data;
>  
>  	while (data && data->next)
> -		data = (struct setup_data *)data->next;
> +		data = (struct setup_data *)(uintptr_t)data->next;
>  
>  	status = efi_call_phys5(sys_table->boottime->locate_handle,
>  				EFI_LOCATE_BY_PROTOCOL, &pci_proto,
> @@ -345,9 +345,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
>  		memcpy(rom->romdata, pci->romimage, pci->romsize);
>  
>  		if (data)
> -			data->next = (uint64_t)rom;
> +			data->next = (uintptr_t)rom;
>  		else
> -			params->hdr.setup_data = (uint64_t)rom;
> +			params->hdr.setup_data = (uintptr_t)rom;
>  
>  		data = (struct setup_data *)rom;
>  
> -- 
> 1.7.10.4

Thanks.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

* Re: [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
  2012-12-26  8:00     ` Borislav Petkov
@ 2013-01-01 17:34         ` H. Peter Anvin
  -1 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2013-01-01 17:34 UTC (permalink / raw)
  To: Borislav Petkov, Stefan Hasko, Matt Fleming, Thomas Gleixner,
	Ingo Molnar, x86-DgEjT+Ai2ygdnm+yROfE0A,
	linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 12/26/2012 12:00 AM, Borislav Petkov wrote:
> On Sat, Dec 22, 2012 at 11:23:25AM +0100, Stefan Hasko wrote:
>> Fixed different size cast warnings in function setup_efi_pci
>>
>> Signed-off-by: Stefan Hasko <hasko.stevo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> You might want to add the actual compiler warnings to the commit
> message:
> 
> arch/x86/boot/compressed/eboot.c: In function ‘setup_efi_pci’:
> arch/x86/boot/compressed/eboot.c:259:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> arch/x86/boot/compressed/eboot.c:262:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> arch/x86/boot/compressed/eboot.c:348:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> arch/x86/boot/compressed/eboot.c:350:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> And yes, I see them in all{mod,yes}config builds here too. The issue,
> AFAICT, is that setup_data is __u64 to obviously accomodate 8-byte
> pointers on x86-64 but on 32-bit they're half the size. And we obviously
> cannot change struct setup_data since this is an ABI so I'd guess the
> casts to native pointer sizes are ok. So
> 
> Acked-by: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
> 

Yes, but stylistically: we don't use uintptr_t in Linux, but rather
"unsigned long".

	-hpa

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

* Re: [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
@ 2013-01-01 17:34         ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2013-01-01 17:34 UTC (permalink / raw)
  To: Borislav Petkov, Stefan Hasko, Matt Fleming, Thomas Gleixner,
	Ingo Molnar, x86, linux-efi, linux-kernel

On 12/26/2012 12:00 AM, Borislav Petkov wrote:
> On Sat, Dec 22, 2012 at 11:23:25AM +0100, Stefan Hasko wrote:
>> Fixed different size cast warnings in function setup_efi_pci
>>
>> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
> 
> You might want to add the actual compiler warnings to the commit
> message:
> 
> arch/x86/boot/compressed/eboot.c: In function ‘setup_efi_pci’:
> arch/x86/boot/compressed/eboot.c:259:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> arch/x86/boot/compressed/eboot.c:262:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> arch/x86/boot/compressed/eboot.c:348:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> arch/x86/boot/compressed/eboot.c:350:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> And yes, I see them in all{mod,yes}config builds here too. The issue,
> AFAICT, is that setup_data is __u64 to obviously accomodate 8-byte
> pointers on x86-64 but on 32-bit they're half the size. And we obviously
> cannot change struct setup_data since this is an ABI so I'd guess the
> casts to native pointer sizes are ok. So
> 
> Acked-by: Borislav Petkov <bp@alien8.de>
> 

Yes, but stylistically: we don't use uintptr_t in Linux, but rather
"unsigned long".

	-hpa



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

* Re: [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms
  2013-01-01 17:34         ` H. Peter Anvin
  (?)
@ 2013-01-03 12:19         ` Borislav Petkov
  -1 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2013-01-03 12:19 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Stefan Hasko, Matt Fleming, Thomas Gleixner, Ingo Molnar, x86,
	linux-efi, linux-kernel

On Tue, Jan 01, 2013 at 09:34:16AM -0800, H. Peter Anvin wrote:
> Yes, but stylistically: we don't use uintptr_t in Linux, but rather
> "unsigned long".

Hmmkay,

Stefan, care to redo your patch and sum up this discussion to the commit
message for further reference?

Btw, there is some funny usage of uintptr_t in
arch/x86/include/asm/xor_avx.h and since this is not an uapi header,
they need to be converted to unsigned long too, methinks.

Thanks.

-- 
Regards/Gruss,
Boris.

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

end of thread, other threads:[~2013-01-03 12:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-22 10:23 [PATCH] arch: x86: boot: compressed: eboot: fix cast warnings on 32b platforms Stefan Hasko
     [not found] ` <1356171805-16930-1-git-send-email-hasko.stevo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-26  8:00   ` Borislav Petkov
2012-12-26  8:00     ` Borislav Petkov
     [not found]     ` <20121226080019.GB11555-f9CnO7I+Q6zU6FkGJEIX5A@public.gmane.org>
2013-01-01 17:34       ` H. Peter Anvin
2013-01-01 17:34         ` H. Peter Anvin
2013-01-03 12:19         ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.