2020-04-29 19:06:13

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] efi/tpm: fix section mismatch warning

Building with gcc-10 causes a harmless warning about a section mismatch:

WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
The function tpm2_calc_event_log_size() references
the function __init early_memunmap().
This is often because tpm2_calc_event_log_size lacks a __init
annotation or the annotation of early_memunmap is wrong.

Add the missing annotation.

Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
Signed-off-by: Arnd Bergmann <[email protected]>
---
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 31f9f0e369b9..55b031d2c989 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -16,7 +16,7 @@
int efi_tpm_final_log_size;
EXPORT_SYMBOL(efi_tpm_final_log_size);

-static int tpm2_calc_event_log_size(void *data, int count, void *size_info)
+static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info)
{
struct tcg_pcr_event2_head *header;
int event_size, size = 0;
--
2.26.0


2020-04-29 19:17:14

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Wed, Apr 29, 2020 at 09:01:08PM +0200, Arnd Bergmann wrote:
> Building with gcc-10 causes a harmless warning about a section mismatch:
>
> WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
> The function tpm2_calc_event_log_size() references
> the function __init early_memunmap().
> This is often because tpm2_calc_event_log_size lacks a __init
> annotation or the annotation of early_memunmap is wrong.
>
> Add the missing annotation.
>
> Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> drivers/firmware/efi/tpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Jason Gunthorpe <[email protected]>

Jason

2020-04-29 19:19:47

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Wed, 29 Apr 2020 at 21:02, Arnd Bergmann <[email protected]> wrote:
>
> Building with gcc-10 causes a harmless warning about a section mismatch:
>
> WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
> The function tpm2_calc_event_log_size() references
> the function __init early_memunmap().
> This is often because tpm2_calc_event_log_size lacks a __init
> annotation or the annotation of early_memunmap is wrong.
>
> Add the missing annotation.
>
> Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> Signed-off-by: Arnd Bergmann <[email protected]>

Thanks, I'll take it as a fix.

> ---
> 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 31f9f0e369b9..55b031d2c989 100644
> --- a/drivers/firmware/efi/tpm.c
> +++ b/drivers/firmware/efi/tpm.c
> @@ -16,7 +16,7 @@
> int efi_tpm_final_log_size;
> EXPORT_SYMBOL(efi_tpm_final_log_size);
>
> -static int tpm2_calc_event_log_size(void *data, int count, void *size_info)
> +static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info)
> {
> struct tcg_pcr_event2_head *header;
> int event_size, size = 0;
> --
> 2.26.0
>

2020-04-30 04:03:34

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Wed, Apr 29, 2020 at 09:01:08PM +0200, Arnd Bergmann wrote:
> Building with gcc-10 causes a harmless warning about a section mismatch:
>
> WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
> The function tpm2_calc_event_log_size() references
> the function __init early_memunmap().
> This is often because tpm2_calc_event_log_size lacks a __init
> annotation or the annotation of early_memunmap is wrong.
>
> Add the missing annotation.
>
> Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> Signed-off-by: Arnd Bergmann <[email protected]>

Acked-by: Jarkko Sakkinen <[email protected]>

/Jarkko

2020-04-30 21:17:27

by Jerry Snitselaar

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Wed Apr 29 20, Arnd Bergmann wrote:
>Building with gcc-10 causes a harmless warning about a section mismatch:
>
>WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
>The function tpm2_calc_event_log_size() references
>the function __init early_memunmap().
>This is often because tpm2_calc_event_log_size lacks a __init
>annotation or the annotation of early_memunmap is wrong.
>
>Add the missing annotation.
>
>Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
>Signed-off-by: Arnd Bergmann <[email protected]>

Minor thing, but should the Fixes be c46f3405692d ("tpm: Reserve the TPM final events table")? Or what am I missing
about e658c82be556 that causes this? Just trying to understand what I did. :)

Regards,
Jerry

>---
> 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 31f9f0e369b9..55b031d2c989 100644
>--- a/drivers/firmware/efi/tpm.c
>+++ b/drivers/firmware/efi/tpm.c
>@@ -16,7 +16,7 @@
> int efi_tpm_final_log_size;
> EXPORT_SYMBOL(efi_tpm_final_log_size);
>
>-static int tpm2_calc_event_log_size(void *data, int count, void *size_info)
>+static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info)
> {
> struct tcg_pcr_event2_head *header;
> int event_size, size = 0;
>--
>2.26.0
>

2020-04-30 21:25:26

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Thu, Apr 30, 2020 at 11:15 PM Jerry Snitselaar <[email protected]> wrote:
>
> On Wed Apr 29 20, Arnd Bergmann wrote:
> >Building with gcc-10 causes a harmless warning about a section mismatch:
> >
> >WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
> >The function tpm2_calc_event_log_size() references
> >the function __init early_memunmap().
> >This is often because tpm2_calc_event_log_size lacks a __init
> >annotation or the annotation of early_memunmap is wrong.
> >
> >Add the missing annotation.
> >
> >Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> >Signed-off-by: Arnd Bergmann <[email protected]>
>
> Minor thing, but should the Fixes be c46f3405692d ("tpm: Reserve the TPM final events table")? Or what am I missing
> about e658c82be556 that causes this? Just trying to understand what I did. :)

You are right, I misread the git history. Can you fix it up when applying the
patch, or should I resend it?

Arnd

2020-04-30 21:28:42

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Thu, 30 Apr 2020 at 23:21, Arnd Bergmann <[email protected]> wrote:
>
> On Thu, Apr 30, 2020 at 11:15 PM Jerry Snitselaar <[email protected]> wrote:
> >
> > On Wed Apr 29 20, Arnd Bergmann wrote:
> > >Building with gcc-10 causes a harmless warning about a section mismatch:
> > >
> > >WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
> > >The function tpm2_calc_event_log_size() references
> > >the function __init early_memunmap().
> > >This is often because tpm2_calc_event_log_size lacks a __init
> > >annotation or the annotation of early_memunmap is wrong.
> > >
> > >Add the missing annotation.
> > >
> > >Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> > >Signed-off-by: Arnd Bergmann <[email protected]>
> >
> > Minor thing, but should the Fixes be c46f3405692d ("tpm: Reserve the TPM final events table")? Or what am I missing
> > about e658c82be556 that causes this? Just trying to understand what I did. :)
>
> You are right, I misread the git history. Can you fix it up when applying the
> patch, or should I resend it?
>

I can fix it up, no worries.

2020-04-30 21:34:36

by Jerry Snitselaar

[permalink] [raw]
Subject: Re: [PATCH] efi/tpm: fix section mismatch warning

On Thu Apr 30 20, Ard Biesheuvel wrote:
>On Thu, 30 Apr 2020 at 23:21, Arnd Bergmann <[email protected]> wrote:
>>
>> On Thu, Apr 30, 2020 at 11:15 PM Jerry Snitselaar <[email protected]> wrote:
>> >
>> > On Wed Apr 29 20, Arnd Bergmann wrote:
>> > >Building with gcc-10 causes a harmless warning about a section mismatch:
>> > >
>> > >WARNING: modpost: vmlinux.o(.text.unlikely+0x5e191): Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
>> > >The function tpm2_calc_event_log_size() references
>> > >the function __init early_memunmap().
>> > >This is often because tpm2_calc_event_log_size lacks a __init
>> > >annotation or the annotation of early_memunmap is wrong.
>> > >
>> > >Add the missing annotation.
>> > >
>> > >Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
>> > >Signed-off-by: Arnd Bergmann <[email protected]>
>> >
>> > Minor thing, but should the Fixes be c46f3405692d ("tpm: Reserve the TPM final events table")? Or what am I missing
>> > about e658c82be556 that causes this? Just trying to understand what I did. :)
>>
>> You are right, I misread the git history. Can you fix it up when applying the
>> patch, or should I resend it?
>>
>
>I can fix it up, no worries.
>

With the fix applied:

Reviewed-by: Jerry Snitselaar <[email protected]>