• Borislav Petkov's avatar
    x86/efi: Fix EFI memmap pointer size warning · 02e56902
    Borislav Petkov authored
    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
    build.)
    
    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: default avatarBorislav Petkov <bp@suse.de>
    Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/20161112210424.5157-2-matt@codeblueprint.co.ukSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    02e56902
efi.c 24.9 KB