Linux-EFI Archive on
 help / color / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/>
To: Ingo Molnar <>,
	Thomas Gleixner <>,
	"H . Peter Anvin" <>
Cc: Borislav Petkov <>,
	Ard Biesheuvel
	Matt Fleming
Subject: [PATCH 1/2] x86/efi: Fix EFI memmap pointer size warning
Date: Sat, 12 Nov 2016 21:04:23 +0000
Message-ID: <> (raw)
In-Reply-To: <20161112210424.5157-1-matt-mF/unelCI9GS6iBeEJttW/>

From: Borislav Petkov <>

Fix this when building on 32-bit:

  arch/x86/platform/efi/efi.c: In function ‘__efi_enter_virtual_mode’:
  arch/x86/platform/efi/efi.c:911:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       (efi_memory_desc_t *)pa);
  arch/x86/platform/efi/efi.c:918:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       (efi_memory_desc_t *)pa);

The @pa local variable is declared as phys_addr_t and that is a u64 when
CONFIG_PHYS_ADDR_T_64BIT=y. (The last is enabled on 32-bit on a PAE

However, its value comes from __pa() which is basically doing pointer
arithmetic and checking, and returns unsigned long as it is the native
pointer width.

So let's use an unsigned long too. It should be fine to do so because
the later users cast it to a pointer too.

Signed-off-by: Borislav Petkov <>
Cc: Ard Biesheuvel <>
Signed-off-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/>
 arch/x86/platform/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index bf99aa7005eb..936a488d6cf6 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -861,7 +861,7 @@ static void __init __efi_enter_virtual_mode(void)
 	int count = 0, pg_shift = 0;
 	void *new_memmap = NULL;
 	efi_status_t status;
-	phys_addr_t pa;
+	unsigned long pa;
 	efi.systab = NULL;

  parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 21:04 [GIT PULL 0/2] EFI urgent fixes Matt Fleming
     [not found] ` <20161112210424.5157-1-matt-mF/unelCI9GS6iBeEJttW/>
2016-11-12 21:04   ` Matt Fleming [this message]
2016-11-12 21:04   ` [PATCH 2/2] x86/efi: Prevent mixed mode boot corruption with CONFIG_VMAP_STACK Matt Fleming

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:

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

  git send-email \ \
    --to=matt-mf/unelci9gs6ibeejttw/ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EFI Archive on

Archives are clonable:
	git clone --mirror linux-efi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-efi linux-efi/ \
	public-inbox-index linux-efi

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone