[efi:next 8/8] drivers/firmware/efi/efi-bgrt.c:109:73: warning: comparison of distinct pointer types lacks a cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
head:   4543fea0423b221d6d77224c595d73797ff958c7
commit: 4543fea0423b221d6d77224c595d73797ff958c7 [8/8] 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 4543fea0423b221d6d77224c595d73797ff958c7
        # 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:109:73: warning: comparison of distinct pointer types lacks a cast
     memcpy(bgrt, table, min(len, sizeof(bgrt_tab)));
                                                                            ^ 

vim +109 drivers/firmware/efi/efi-bgrt.c

    29	
    30	void __init efi_bgrt_init(unsigned long rsdp_phys)
    31	{
    32		void *image;
    33		struct bmp_header bmp_header;
    34		struct acpi_table_bgrt *bgrt = &bgrt_tab;
    35		struct acpi_table_bgrt *table = NULL;
    36		struct acpi_table_rsdp *rsdp;
    37		struct acpi_table_header *hdr;
    38		u64 xsdt_phys = 0;
    39		u32 rsdt_phys = 0;
    40		unsigned long len;
    41	
    42		if (!efi_enabled(EFI_MEMMAP))
    43			return;
    44	
    45		/* map the root pointer table to find the xsdt/rsdt values */
    46		rsdp = early_memremap_ro(rsdp_phys, sizeof(*rsdp));
    47		if (rsdp) {
    48			if (ACPI_VALIDATE_RSDP_SIG(rsdp->signature)) {
    49				xsdt_phys = rsdp->xsdt_physical_address;
    50				rsdt_phys = rsdp->rsdt_physical_address;
    51			}
    52			early_memunmap(rsdp, sizeof(*rsdp));
    53		}
    54	
    55		if (WARN_ON(!xsdt_phys && !rsdt_phys))
    56			return;
    57	
    58		/* obtain the length of whichever table we will be using */
    59		hdr = early_memremap_ro(xsdt_phys ?: rsdt_phys, sizeof(*hdr));
    60		if (WARN_ON(!hdr))
    61			return;
    62		len = hdr->length;
    63		early_memunmap(hdr, sizeof(*hdr));
    64	
    65		/* remap with the correct length */
    66		hdr = early_memremap_ro(xsdt_phys ?: rsdt_phys, len);
    67		if (WARN_ON(!hdr))
    68			return;
    69	
    70		if (xsdt_phys) {
    71			struct acpi_table_xsdt *xsdt = (void *)hdr;
    72			int i;
    73	
    74			for (i = 0; i < (len - sizeof(*hdr)) / sizeof(u64); i++) {
    75				table = early_memremap_ro(xsdt->table_offset_entry[i],
    76							  sizeof(*table));
    77				if (WARN_ON(!table))
    78					break;
    79	
    80				if (ACPI_COMPARE_NAME(table->header.signature,
    81						      ACPI_SIG_BGRT))
    82					break;
    83				early_memunmap(table, sizeof(*table));
    84				table = NULL;
    85			}
    86		} else if (rsdt_phys) {
    87			struct acpi_table_rsdt *rsdt = (void *)hdr;
    88			int i;
    89	
    90			for (i = 0; i < (len - sizeof(*hdr)) / sizeof(u32); i++) {
    91				table = early_memremap_ro(rsdt->table_offset_entry[i],
    92							  sizeof(*table));
    93				if (WARN_ON(!table))
    94					break;
    95	
    96				if (ACPI_COMPARE_NAME(table->header.signature,
    97						      ACPI_SIG_BGRT))
    98					break;
    99				early_memunmap(table, sizeof(*table));
   100				table = NULL;
   101			}
   102		}
   103		early_memunmap(hdr, len);
   104	
   105		if (!table)
   106			return;
   107	
   108		len = table->header.length;
 > 109		memcpy(bgrt, table, min(len, sizeof(bgrt_tab)));

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux