Hi Hans,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Hans-de-Goede/efi-Export-boot-services-code-and-data-as-debugfs-blobs/20180401-062627
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All error/warnings (new ones prefixed by >>):

   drivers/firmware/efi/embedded-firmware.c: In function 
'efi_check_md_for_embedded_firmware':
>> drivers/firmware/efi/embedded-firmware.c:125:8: error: implicit declaration 
>> of function 'memremap'; did you mean 'memset_p'? 
>> [-Werror=implicit-function-declaration]
     mem = memremap(md->phys_addr, size, MEMREMAP_WB);
           ^~~~~~~~
           memset_p
>> drivers/firmware/efi/embedded-firmware.c:125:38: error: 'MEMREMAP_WB' 
>> undeclared (first use in this function)
     mem = memremap(md->phys_addr, size, MEMREMAP_WB);
                                         ^~~~~~~~~~~
   drivers/firmware/efi/embedded-firmware.c:125:38: note: each undeclared 
identifier is reported only once for each function it appears in
>> drivers/firmware/efi/embedded-firmware.c:142:2: error: implicit declaration 
>> of function 'memunmap'; did you mean 'memcmp'? 
>> [-Werror=implicit-function-declaration]
     memunmap(mem);
     ^~~~~~~~
     memcmp
   drivers/firmware/efi/embedded-firmware.c: In function 'efi_get_embedded_fw':
>> drivers/firmware/efi/embedded-firmware.c:222:9: error: implicit declaration 
>> of function 'vmalloc'; did you mean 'd_alloc'? 
>> [-Werror=implicit-function-declaration]
      buf = vmalloc(fw->length);
            ^~~~~~~
            d_alloc
>> drivers/firmware/efi/embedded-firmware.c:222:7: warning: assignment makes 
>> pointer from integer without a cast [-Wint-conversion]
      buf = vmalloc(fw->length);
          ^
   cc1: some warnings being treated as errors

vim +125 drivers/firmware/efi/embedded-firmware.c

   109  
   110  /*
   111   * Note the efi_check_for_embedded_firmwares() code currently makes the
   112   * following 2 assumptions. This may needs to be revisited if embedded 
firmware
   113   * is found where this is not true:
   114   * 1) The firmware is only found in EFI_BOOT_SERVICES_CODE memory 
segments
   115   * 2) The firmware always starts at an offset which is a multiple of 8 
bytes
   116   */
   117  static int __init efi_check_md_for_embedded_firmware(
   118          efi_memory_desc_t *md, const struct embedded_fw_desc *desc)
   119  {
   120          u64 i, size;
   121          u32 crc;
   122          u8 *mem;
   123  
   124          size = md->num_pages << EFI_PAGE_SHIFT;
 > 125          mem = memremap(md->phys_addr, size, MEMREMAP_WB);
   126          if (!mem) {
   127                  pr_err("Error mapping EFI mem at %#llx\n", 
md->phys_addr);
   128                  return -ENOMEM;
   129          }
   130  
   131          size -= desc->length;
   132          for (i = 0; i < size; i += 8) {
   133                  if (*((u64 *)(mem + i)) != *((u64 *)desc->prefix))
   134                          continue;
   135  
   136                  /* Seed with ~0, invert to match crc32 userspace 
utility */
   137                  crc = ~crc32(~0, mem + i, desc->length);
   138                  if (crc == desc->crc)
   139                          break;
   140          }
   141  
 > 142          memunmap(mem);
   143  
   144          if (i >= size)
   145                  return -ENOENT;
   146  
   147          pr_info("Found EFI embedded fw '%s' crc %08x\n", desc->name, 
desc->crc);
   148  
   149          if (found_fw_count >= MAX_EMBEDDED_FIRMWARES) {
   150                  pr_err("Error already have %d embedded firmwares\n",
   151                         MAX_EMBEDDED_FIRMWARES);
   152                  return -ENOSPC;
   153          }
   154  
   155          found_fw[found_fw_count].data =
   156                  memremap(md->phys_addr + i, desc->length, MEMREMAP_WB);
   157          if (!found_fw[found_fw_count].data) {
   158                  pr_err("Error mapping embedded firmware\n");
   159                  return -ENOMEM;
   160          }
   161  
   162          found_fw[found_fw_count].name = desc->name;
   163          found_fw[found_fw_count].length = desc->length;
   164          found_fw_count++;
   165  
   166          /* Note md points to *unmapped* memory after this!!! */
   167          efi_mem_reserve(md->phys_addr + i, desc->length);
   168          return 0;
   169  }
   170  
   171  void __init efi_check_for_embedded_firmwares(void)
   172  {
   173          const struct embedded_fw_desc *fw_desc;
   174          const struct dmi_system_id *dmi_id;
   175          efi_memory_desc_t *md;
   176          int i, r;
   177  
   178          dmi_id = dmi_first_match(embedded_fw_table);
   179          if (!dmi_id)
   180                  return;
   181  
   182          fw_desc = dmi_id->driver_data;
   183          for (i = 0; fw_desc[i].length; i++) {
   184                  for_each_efi_memory_desc(md) {
   185                          if (md->type != EFI_BOOT_SERVICES_CODE)
   186                                  continue;
   187  
   188                          r = efi_check_md_for_embedded_firmware(md, 
&fw_desc[i]);
   189                          if (r == 0) {
   190                                  /*
   191                                   * On success efi_mem_reserve() has 
been called
   192                                   * installing a new memmap, so our 
pointers
   193                                   * are invalid now and we MUST break 
the loop.
   194                                   */
   195                                  break;
   196                          }
   197                  }
   198          }
   199  }
   200  
   201  int efi_get_embedded_fw(const char *name, void **data, size_t *size,
   202                          size_t msize)
   203  {
   204          struct embedded_fw *fw = NULL;
   205          void *buf = *data;
   206          int i;
   207  
   208          for (i = 0; i < found_fw_count; i++) {
   209                  if (strcmp(name, found_fw[i].name) == 0) {
   210                          fw = &found_fw[i];
   211                          break;
   212                  }
   213          }
   214  
   215          if (!fw)
   216                  return -ENOENT;
   217  
   218          if (msize && msize < fw->length)
   219                  return -EFBIG;
   220  
   221          if (!buf) {
 > 222                  buf = vmalloc(fw->length);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to