tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next head: a981cafa013805708cb0b393d95083144b45bad2 commit: a981cafa013805708cb0b393d95083144b45bad2 [10/10] acpi: bgrt: parse BGRT to obtain BMP address before it gets clobbered config: i386-allyesconfig (attached as .config) compiler: gcc-8 (Debian 8.2.0-14) 8.2.0 reproduce: git checkout a981cafa013805708cb0b393d95083144b45bad2 # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/firmware//efi/efi-bgrt.c: In function 'efi_bgrt_init': >> drivers/firmware//efi/efi-bgrt.c:110:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Wformat=] pr_notice("Ignoring BGRT: invalid length %lu (expected %zu)\n", ^~~~~~ vim +110 drivers/firmware//efi/efi-bgrt.c 26 27 void __init efi_bgrt_init(unsigned long rsdp_phys) 28 { 29 void *image; 30 struct bmp_header bmp_header; 31 struct acpi_table_bgrt *bgrt = &bgrt_tab; 32 struct acpi_table_bgrt *table = NULL; 33 struct acpi_table_rsdp *rsdp; 34 struct acpi_table_header *hdr; 35 u64 xsdt_phys = 0; 36 u32 rsdt_phys = 0; 37 size_t len; 38 39 if (!efi_enabled(EFI_MEMMAP)) 40 return; 41 42 /* map the root pointer table to find the xsdt/rsdt values */ 43 rsdp = early_memremap_ro(rsdp_phys, sizeof(*rsdp)); 44 if (rsdp) { 45 if (ACPI_VALIDATE_RSDP_SIG(rsdp->signature)) { 46 xsdt_phys = rsdp->xsdt_physical_address; 47 rsdt_phys = rsdp->rsdt_physical_address; 48 } 49 early_memunmap(rsdp, sizeof(*rsdp)); 50 } 51 52 if (WARN_ON(!xsdt_phys && !rsdt_phys)) 53 return; 54 55 /* obtain the length of whichever table we will be using */ 56 hdr = early_memremap_ro(xsdt_phys ?: rsdt_phys, sizeof(*hdr)); 57 if (WARN_ON(!hdr)) 58 return; 59 len = hdr->length; 60 early_memunmap(hdr, sizeof(*hdr)); 61 62 /* remap with the correct length */ 63 hdr = early_memremap_ro(xsdt_phys ?: rsdt_phys, len); 64 if (WARN_ON(!hdr)) 65 return; 66 67 if (xsdt_phys) { 68 struct acpi_table_xsdt *xsdt = (void *)hdr; 69 int i; 70 71 for (i = 0; i < (len - sizeof(*hdr)) / sizeof(u64); i++) { 72 table = early_memremap_ro(xsdt->table_offset_entry[i], 73 sizeof(*table)); 74 if (WARN_ON(!table)) 75 break; 76 77 if (ACPI_COMPARE_NAME(table->header.signature, 78 ACPI_SIG_BGRT)) 79 break; 80 early_memunmap(table, sizeof(*table)); 81 table = NULL; 82 } 83 } else if (rsdt_phys) { 84 struct acpi_table_rsdt *rsdt = (void *)hdr; 85 int i; 86 87 for (i = 0; i < (len - sizeof(*hdr)) / sizeof(u32); i++) { 88 table = early_memremap_ro(rsdt->table_offset_entry[i], 89 sizeof(*table)); 90 if (WARN_ON(!table)) 91 break; 92 93 if (ACPI_COMPARE_NAME(table->header.signature, 94 ACPI_SIG_BGRT)) 95 break; 96 early_memunmap(table, sizeof(*table)); 97 table = NULL; 98 } 99 } 100 early_memunmap(hdr, len); 101 102 if (!table) 103 return; 104 105 len = table->header.length; 106 memcpy(bgrt, table, min(len, sizeof(bgrt_tab))); 107 early_memunmap(table, sizeof(*table)); 108 109 if (len < sizeof(bgrt_tab)) { > 110 pr_notice("Ignoring BGRT: invalid length %lu (expected %zu)\n", --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip