linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Matthew Garrett' <matthewgarrett@google.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>
Cc: "peterhuewe@gmx.de" <peterhuewe@gmx.de>,
	"jarkko.sakkinen@linux.intel.com"
	<jarkko.sakkinen@linux.intel.com>, "jgg@ziepe.ca" <jgg@ziepe.ca>,
	"roberto.sassu@huawei.com" <roberto.sassu@huawei.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-security-module@vger.kernel.org" 
	<linux-security-module@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tweek@google.com" <tweek@google.com>,
	Matthew Garrett <mjg59@google.com>
Subject: RE: [PATCH 1/2] efi: Fix cast to pointer from integer of different size in TPM log code
Date: Wed, 3 Apr 2019 13:42:36 +0000	[thread overview]
Message-ID: <89e1cf4093d7405987c55f682519f9fc@AcuMS.aculab.com> (raw)
In-Reply-To: <20190402215556.257406-2-matthewgarrett@google.com>

From: Matthew Garrett
> Sent: 02 April 2019 22:56
> 
> 8bfcff4a6a1d9d7226bb63a7da758b82d9ab4373 introduced a cast from
> efi_physical_address_t to (void *), which are different sizes on 32-bit.
> Fix that. Caught by the 0-day test bot.

Casting a physical address to 'void *' seems completely wrong.
Also you'd need a guarantee that the address was below 4G or the result
is meaningless.
Looks to me like something is using the wrong types somewhere.

	David

> Signed-off-by: Matthew Garrett <mjg59@google.com>
> ---
>  drivers/firmware/efi/libstub/tpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
> index b6e93e14fcf1..6b3b507a54eb 100644
> --- a/drivers/firmware/efi/libstub/tpm.c
> +++ b/drivers/firmware/efi/libstub/tpm.c
> @@ -114,8 +114,8 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
>  			 */
>  			last_entry_size =
>  				__calc_tpm2_event_size((void *)last_entry_addr,
> -						       (void *)log_location,
> -						       false);
> +						    (void *)(long)log_location,
> +						    false);
>  		} else {
>  			last_entry_size = sizeof(struct tcpa_event) +
>  			   ((struct tcpa_event *) last_entry_addr)->event_size;
> --
> 2.21.0.392.gf8f6787159e-goog

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  reply	other threads:[~2019-04-03 13:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 21:55 [PATCH] TCG2 log support build fixes for non-x86_64 Matthew Garrett
2019-04-02 21:55 ` [PATCH 1/2] efi: Fix cast to pointer from integer of different size in TPM log code Matthew Garrett
2019-04-03 13:42   ` David Laight [this message]
2019-04-03 16:51     ` Matthew Garrett
2019-04-04 12:39   ` Jarkko Sakkinen
2019-04-04 12:54   ` Ard Biesheuvel
2019-04-04 17:23     ` Matthew Garrett
2019-04-02 21:55 ` [PATCH 2/2] tpm: Fix builds on platforms that lack early_memremap() Matthew Garrett
2019-04-04 12:40   ` Jarkko Sakkinen
2019-04-04 12:40 ` [PATCH] TCG2 log support build fixes for non-x86_64 Jarkko Sakkinen
2019-04-04 17:24   ` Matthew Garrett
2019-04-15  8:47 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89e1cf4093d7405987c55f682519f9fc@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=matthewgarrett@google.com \
    --cc=mjg59@google.com \
    --cc=peterhuewe@gmx.de \
    --cc=roberto.sassu@huawei.com \
    --cc=tweek@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).