diff mbox series

[1/2] efi_loader: refine set_keyboard_layout() status

Message ID 20230106094641.3377853-2-vincent.stehle@arm.com
State Accepted, archived
Commit 65b91a346ebed631494b6ad405dbd91e07157ec4
Delegated to: Heinrich Schuchardt
Headers show
Series efi: small hii set_keyboard_layout conformance improvement | expand

Commit Message

Vincent Stehlé Jan. 6, 2023, 9:46 a.m. UTC
As per the EFI specification, the HII database protocol function
set_keyboard_layout() must return EFI_INVALID_PARAMETER when it is called
with a NULL key_guid argument. Modify the function accordingly to improve
conformance.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/efi_hii.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Heinrich Schuchardt Jan. 6, 2023, 3:27 p.m. UTC | #1
On 1/6/23 10:46, Vincent Stehlé wrote:
> As per the EFI specification, the HII database protocol function
> set_keyboard_layout() must return EFI_INVALID_PARAMETER when it is called
> with a NULL key_guid argument. Modify the function accordingly to improve
> conformance.
>
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>   lib/efi_loader/efi_hii.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c
> index 27db3be6a17..3b54ecb11ac 100644
> --- a/lib/efi_loader/efi_hii.c
> +++ b/lib/efi_loader/efi_hii.c
> @@ -758,6 +758,9 @@ set_keyboard_layout(const struct efi_hii_database_protocol *this,
>   {
>   	EFI_ENTRY("%p, %pUs", this, key_guid);
>
> +	if (!key_guid)
> +		return EFI_EXIT(EFI_INVALID_PARAMETER);

This is just suppressing an SCT warning for an unimplemented function. I
think we should complete the implementation of the HII protocols instead
of trying to hide the deficiency.

Best regards

Heinrich

> +
>   	return EFI_EXIT(EFI_NOT_FOUND);
>   }
>
Ilias Apalodimas Jan. 9, 2023, 7 a.m. UTC | #2
On Fri, 6 Jan 2023 at 17:27, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 1/6/23 10:46, Vincent Stehlé wrote:
> > As per the EFI specification, the HII database protocol function
> > set_keyboard_layout() must return EFI_INVALID_PARAMETER when it is called
> > with a NULL key_guid argument. Modify the function accordingly to improve
> > conformance.
> >
> > Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >   lib/efi_loader/efi_hii.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c
> > index 27db3be6a17..3b54ecb11ac 100644
> > --- a/lib/efi_loader/efi_hii.c
> > +++ b/lib/efi_loader/efi_hii.c
> > @@ -758,6 +758,9 @@ set_keyboard_layout(const struct efi_hii_database_protocol *this,
> >   {
> >       EFI_ENTRY("%p, %pUs", this, key_guid);
> >
> > +     if (!key_guid)
> > +             return EFI_EXIT(EFI_INVALID_PARAMETER);
>
> This is just suppressing an SCT warning for an unimplemented function. I
> think we should complete the implementation of the HII protocols instead
> of trying to hide the deficiency.

I don't think we are hiding the fact that the function isn't implemented here.
34.8.11 EFI_HII_DATABASE_PROTOCOL.SetKeyboardLayout() says that we
must return if the KeyGuid is NULL

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


>
> Best regards
>
> Heinrich
>
> > +
> >       return EFI_EXIT(EFI_NOT_FOUND);
> >   }
> >
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c
index 27db3be6a17..3b54ecb11ac 100644
--- a/lib/efi_loader/efi_hii.c
+++ b/lib/efi_loader/efi_hii.c
@@ -758,6 +758,9 @@  set_keyboard_layout(const struct efi_hii_database_protocol *this,
 {
 	EFI_ENTRY("%p, %pUs", this, key_guid);
 
+	if (!key_guid)
+		return EFI_EXIT(EFI_INVALID_PARAMETER);
+
 	return EFI_EXIT(EFI_NOT_FOUND);
 }