Messages in this thread Patch in this message | | | From | Arnd Bergmann <> | Date | Thu, 13 Jun 2019 10:55:33 +0200 | Subject | Re: [PATCH -next] efi/tpm: fix a compilation warning |
| |
On Tue, Jun 11, 2019 at 3:59 PM Qian Cai <cai@lca.pw> wrote: > > The linux-next "tpm: Reserve the TPM final events table" [1] introduced > a compilation warning, > > drivers/firmware/efi/tpm.c: In function 'efi_tpm_eventlog_init': > drivers/firmware/efi/tpm.c:80:10: warning: passing argument 1 of > 'tpm2_calc_event_log_size' makes pointer from integer without a cast > [-Wint-conversion] > tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log > drivers/firmware/efi/tpm.c:19:43: note: expected 'void *' but argument > is of type 'long unsigned int' > > Fix it by making a necessary cast for the argument 1 of > tpm2_calc_event_log_size(). > > [1] https://lore.kernel.org/linux-efi/20190520205501.177637-3-matthewgarrett@google.com/ > > Signed-off-by: Qian Cai <cai@lca.pw>
I see the same build warning, but I don't think adding a cast here solves the problem:
- efi.tpm_final_log is a physical address that gets passed into memremap() to return a pointer - tpm2_calc_event_log_size() takes a pointer argument and dereferences it.
My best guess is that we should pass the output of memremap() here rather than the input:
--- a/drivers/firmware/efi/tpm.c +++ b/drivers/firmware/efi/tpm.c @@ -75,7 +75,7 @@ int __init efi_tpm_eventlog_init(void) goto out; }
- tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log + tbl_size = tpm2_calc_event_log_size(final_tbl + sizeof(final_tbl->version) + sizeof(final_tbl->nr_events), final_tbl->nr_events, No idea if that is actually what was intended here, but it makes the code look more plausible.
Arnd
| |