diff mbox series

efi/tpm: Pass correct address to memblock_reserve

Message ID 20221022152352.1033750-1-jsnitsel@redhat.com
State Accepted
Commit f4cd18c5b2000df0c382f6530eeca9141ea41faf
Headers show
Series efi/tpm: Pass correct address to memblock_reserve | expand

Commit Message

Jerry Snitselaar Oct. 22, 2022, 3:23 p.m. UTC
memblock_reserve() expects a physical address, but the address being
passed for the TPM final events log is what was returned from
early_memremap(). This results in something like the following:

[    0.000000] memblock_reserve: [0xffffffffff2c0000-0xffffffffff2c00e4] efi_tpm_eventlog_init+0x324/0x370

Pass the address from efi like what is done for the TPM events log.

Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
Cc: Matthew Garrett <mjg59@google.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Bartosz Szczepanek <bsz@semihalf.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 drivers/firmware/efi/tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Sakkinen Oct. 23, 2022, 9:59 p.m. UTC | #1
On Sat, Oct 22, 2022 at 08:23:52AM -0700, Jerry Snitselaar wrote:
> memblock_reserve() expects a physical address, but the address being
> passed for the TPM final events log is what was returned from
> early_memremap(). This results in something like the following:
> 
> [    0.000000] memblock_reserve: [0xffffffffff2c0000-0xffffffffff2c00e4] efi_tpm_eventlog_init+0x324/0x370
> 
> Pass the address from efi like what is done for the TPM events log.
> 
> Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
> Cc: Matthew Garrett <mjg59@google.com>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Bartosz Szczepanek <bsz@semihalf.com>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
> ---
>  drivers/firmware/efi/tpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> index 8f665678e9e3..e8d69bd548f3 100644
> --- a/drivers/firmware/efi/tpm.c
> +++ b/drivers/firmware/efi/tpm.c
> @@ -97,7 +97,7 @@ int __init efi_tpm_eventlog_init(void)
>  		goto out_calc;
>  	}
>  
> -	memblock_reserve((unsigned long)final_tbl,
> +	memblock_reserve(efi.tpm_final_log,
>  			 tbl_size + sizeof(*final_tbl));
>  	efi_tpm_final_log_size = tbl_size;
>  
> -- 
> 2.37.2
> 


Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko
Ard Biesheuvel Oct. 24, 2022, 6:04 a.m. UTC | #2
On Sun, 23 Oct 2022 at 23:59, Jarkko Sakkinen <jarkko@kernel.org> wrote:
>
> On Sat, Oct 22, 2022 at 08:23:52AM -0700, Jerry Snitselaar wrote:
> > memblock_reserve() expects a physical address, but the address being
> > passed for the TPM final events log is what was returned from
> > early_memremap(). This results in something like the following:
> >
> > [    0.000000] memblock_reserve: [0xffffffffff2c0000-0xffffffffff2c00e4] efi_tpm_eventlog_init+0x324/0x370
> >
> > Pass the address from efi like what is done for the TPM events log.
> >
> > Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
> > Cc: Matthew Garrett <mjg59@google.com>
> > Cc: Jarkko Sakkinen <jarkko@kernel.org>
> > Cc: Bartosz Szczepanek <bsz@semihalf.com>
> > Cc: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
> > ---
> >  drivers/firmware/efi/tpm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> > index 8f665678e9e3..e8d69bd548f3 100644
> > --- a/drivers/firmware/efi/tpm.c
> > +++ b/drivers/firmware/efi/tpm.c
> > @@ -97,7 +97,7 @@ int __init efi_tpm_eventlog_init(void)
> >               goto out_calc;
> >       }
> >
> > -     memblock_reserve((unsigned long)final_tbl,
> > +     memblock_reserve(efi.tpm_final_log,
> >                        tbl_size + sizeof(*final_tbl));
> >       efi_tpm_final_log_size = tbl_size;
> >
> > --
> > 2.37.2
> >
>
>
> Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
>


Queued as a fix,

Thanks all,
diff mbox series

Patch

diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
index 8f665678e9e3..e8d69bd548f3 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -97,7 +97,7 @@  int __init efi_tpm_eventlog_init(void)
 		goto out_calc;
 	}
 
-	memblock_reserve((unsigned long)final_tbl,
+	memblock_reserve(efi.tpm_final_log,
 			 tbl_size + sizeof(*final_tbl));
 	efi_tpm_final_log_size = tbl_size;