Re: [PATCH 3/3] efi: stmm: Drop unneeded null pointer check
From: Ilias Apalodimas
Date: Wed Aug 20 2025 - 02:45:05 EST
Hi Jan
On Fri, 15 Aug 2025 at 22:12, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> wrote:
>
> From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
>
> The API documenation of setup_mm_hdr does not mention that dptr can be
> NULL, this is a local function, and no caller passes NULL. So drop the
> unneeded check.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
> ---
> drivers/firmware/efi/stmm/tee_stmm_efi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> index bf992b42be70..ff41667b1005 100644
> --- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
> +++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
> @@ -191,8 +191,7 @@ static void *setup_mm_hdr(u8 **dptr, size_t *nr_pages, size_t payload_size,
>
> var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data;
> var_hdr->function = func;
> - if (dptr)
> - *dptr = comm_buf;
> + *dptr = comm_buf;
I think this is ok, eventually tee_mm_communicate() will check for a
NULL ptr and return EFI_INVALID_PARAMETER;
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx>
> *ret = EFI_SUCCESS;
>
> return var_hdr->data;
> --
> 2.43.0
>