diff mbox series

[1/1] efi_loader: build warning in efi_tcg2_hash_log_extend_event

Message ID 20210512154038.48877-1-xypron.glpk@gmx.de
State Accepted, archived
Commit 700f68c35484c9de1c2e5e30dfc4c7a63b991a92
Delegated to: Heinrich Schuchardt
Headers show
Series [1/1] efi_loader: build warning in efi_tcg2_hash_log_extend_event | expand

Commit Message

Heinrich Schuchardt May 12, 2021, 3:40 p.m. UTC
Building 32bit boards with the TCG2 protocol enabled leads to a build
warning due to a missing conversion.

    lib/efi_loader/efi_tcg2.c:774:27:
    error: cast to pointer from integer of different size
    [-Werror=int-to-pointer-cast]
    774 |  ret = tcg2_create_digest((u8 *)data_to_hash, data_to_hash_len,
        |                           ^

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_tcg2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.31.1

Comments

Ilias Apalodimas May 12, 2021, 4:44 p.m. UTC | #1
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

On Wed, 12 May 2021 at 18:40, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Building 32bit boards with the TCG2 protocol enabled leads to a build
> warning due to a missing conversion.
>
>     lib/efi_loader/efi_tcg2.c:774:27:
>     error: cast to pointer from integer of different size
>     [-Werror=int-to-pointer-cast]
>     774 |  ret = tcg2_create_digest((u8 *)data_to_hash, data_to_hash_len,
>         |                           ^
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/efi_loader/efi_tcg2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
> index 7b5a443fb6..39ef250bf9 100644
> --- a/lib/efi_loader/efi_tcg2.c
> +++ b/lib/efi_loader/efi_tcg2.c
> @@ -771,8 +771,8 @@ efi_tcg2_hash_log_extend_event(struct efi_tcg2_protocol *this, u64 flags,
>         pcr_index = efi_tcg_event->header.pcr_index;
>         event_type = efi_tcg_event->header.event_type;
>
> -       ret = tcg2_create_digest((u8 *)data_to_hash, data_to_hash_len,
> -                                &digest_list);
> +       ret = tcg2_create_digest((u8 *)(uintptr_t)data_to_hash,
> +                                data_to_hash_len, &digest_list);
>         if (ret != EFI_SUCCESS)
>                 goto out;
>
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 7b5a443fb6..39ef250bf9 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -771,8 +771,8 @@  efi_tcg2_hash_log_extend_event(struct efi_tcg2_protocol *this, u64 flags,
 	pcr_index = efi_tcg_event->header.pcr_index;
 	event_type = efi_tcg_event->header.event_type;

-	ret = tcg2_create_digest((u8 *)data_to_hash, data_to_hash_len,
-				 &digest_list);
+	ret = tcg2_create_digest((u8 *)(uintptr_t)data_to_hash,
+				 data_to_hash_len, &digest_list);
 	if (ret != EFI_SUCCESS)
 		goto out;