linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/xen/efi: Fix EFI variable 'name' type conversion
@ 2019-09-01  6:58 Adam Zerella
  2019-09-02  7:54 ` [Xen-devel] " Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Zerella @ 2019-09-01  6:58 UTC (permalink / raw)
  Cc: Adam Zerella, Boris Ostrovsky, Juergen Gross, Stefano Stabellini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	x86, xen-devel, linux-kernel

This resolves a type conversion from 'char *' to 'unsigned short'.
and static usage warning as hinted by Sparse.

Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
---
 arch/x86/xen/efi.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index 0d3365cb64de..1d4eff6c6f06 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -118,8 +118,8 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
 	unsigned long size;
 
 	size = sizeof(secboot);
-	status = efi.get_variable(L"SecureBoot", &efi_variable_guid,
-				  NULL, &size, &secboot);
+	status = efi.get_variable((efi_char16_t *)L"SecureBoot",
+				  &efi_variable_guid, NULL, &size, &secboot);
 
 	if (status == EFI_NOT_FOUND)
 		return efi_secureboot_mode_disabled;
@@ -128,8 +128,8 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
 		goto out_efi_err;
 
 	size = sizeof(setupmode);
-	status = efi.get_variable(L"SetupMode", &efi_variable_guid,
-				  NULL, &size, &setupmode);
+	status = efi.get_variable((efi_char16_t *)L"SetupMode",
+				  &efi_variable_guid, NULL, &size, &setupmode);
 
 	if (status != EFI_SUCCESS)
 		goto out_efi_err;
@@ -139,8 +139,8 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
 
 	/* See if a user has put the shim into insecure mode. */
 	size = sizeof(moksbstate);
-	status = efi.get_variable(L"MokSBStateRT", &shim_guid,
-				  NULL, &size, &moksbstate);
+	status = efi.get_variable((efi_char16_t *)L"MokSBStateRT",
+				  &shim_guid, NULL, &size, &moksbstate);
 
 	/* If it fails, we don't care why. Default to secure. */
 	if (status != EFI_SUCCESS)
@@ -158,7 +158,7 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
 	return efi_secureboot_mode_unknown;
 }
 
-void __init xen_efi_init(struct boot_params *boot_params)
+static void __init xen_efi_init(struct boot_params *boot_params)
 {
 	efi_system_table_t *efi_systab_xen;
 
-- 
2.21.0


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

* Re: [Xen-devel] [PATCH] x86/xen/efi: Fix EFI variable 'name' type conversion
  2019-09-01  6:58 [PATCH] x86/xen/efi: Fix EFI variable 'name' type conversion Adam Zerella
@ 2019-09-02  7:54 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2019-09-02  7:54 UTC (permalink / raw)
  To: Adam Zerella
  Cc: Borislav Petkov, Stefano Stabellini, x86, Thomas Gleixner,
	xen-devel, Boris Ostrovsky, Ingo Molnar, Juergen Gross,
	linux-kernel, H. Peter Anvin

On 01.09.2019 08:58, Adam Zerella wrote:
> This resolves a type conversion from 'char *' to 'unsigned short'.

Could you explain this? There's no ...

> --- a/arch/x86/xen/efi.c
> +++ b/arch/x86/xen/efi.c
> @@ -118,8 +118,8 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
>  	unsigned long size;
>  
>  	size = sizeof(secboot);
> -	status = efi.get_variable(L"SecureBoot", &efi_variable_guid,
> -				  NULL, &size, &secboot);
> +	status = efi.get_variable((efi_char16_t *)L"SecureBoot",
> +				  &efi_variable_guid, NULL, &size, &secboot);

... "char *" resulting as type for L"" type strings, hence there
should be no need for a cast: In fact I consider such casts
dangerous, as they may hide actual problems. To me this looks
more like something that wants fixing in sparse; the compilers,
after all, have no issue with such wide character string literals.

> @@ -158,7 +158,7 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
>  	return efi_secureboot_mode_unknown;
>  }
>  
> -void __init xen_efi_init(struct boot_params *boot_params)
> +static void __init xen_efi_init(struct boot_params *boot_params)
>  {
>  	efi_system_table_t *efi_systab_xen;

If I was a maintainer of this code, I'd request this not be part
of a patch with a title being entirely unrelated to the change.

Jan

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

end of thread, other threads:[~2019-09-02  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01  6:58 [PATCH] x86/xen/efi: Fix EFI variable 'name' type conversion Adam Zerella
2019-09-02  7:54 ` [Xen-devel] " Jan Beulich

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