[efi:next 8/8] drivers/firmware//efi/efi-bgrt.c:109:22: note: in expansion of macro 'min'

[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-randconfig-b0-02011955 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        git checkout 4543fea0423b221d6d77224c595d73797ff958c7
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from arch/x86/include/asm/page_32.h:35,
                    from arch/x86/include/asm/page.h:14,
                    from arch/x86/include/asm/thread_info.h:12,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/slab.h:15,
                    from include/linux/resource_ext.h:19,
                    from include/linux/acpi.h:26,
                    from drivers/firmware//efi/efi-bgrt.c:18:
   drivers/firmware//efi/efi-bgrt.c: In function 'efi_bgrt_init':
   include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   arch/x86/include/asm/string_32.h:183:48: note: in definition of macro 'memcpy'
    #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
                                                   ^
   include/linux/kernel.h:860:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^
   include/linux/kernel.h:870:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^
   include/linux/kernel.h:879:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^
>> drivers/firmware//efi/efi-bgrt.c:109:22: note: in expansion of macro 'min'
     memcpy(bgrt, table, min(len, sizeof(bgrt_tab)));
                         ^

vim +/min +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