[efi:next 26/32] drivers/firmware/efi/libstub/x86-stub.c:444:25: warning: passing argument 2 of 'efi_stub_entry' discards 'const' qualifier from pointer target type

[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:   473c9781f528e90524a6cf793c3129c7e878306f
commit: 7400323279b963711788010c23e764907a3693c3 [26/32] efi/libstub: Drop __pure getter for efi_system_table
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        git checkout 7400323279b963711788010c23e764907a3693c3
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   drivers/firmware/efi/libstub/x86-stub.c: In function 'efi_pe_entry':
>> drivers/firmware/efi/libstub/x86-stub.c:444:25: warning: passing argument 2 of 'efi_stub_entry' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     efi_stub_entry(handle, efi_system_table, boot_params);
                            ^~~~~~~~~~~~~~~~
   drivers/firmware/efi/libstub/x86-stub.c:352:17: note: expected 'efi_system_table_t * {aka union <anonymous> *}' but argument is of type 'const efi_system_table_t * {aka const union <anonymous> *}'
    void __noreturn efi_stub_entry(efi_handle_t handle,
                    ^~~~~~~~~~~~~~

vim +444 drivers/firmware/efi/libstub/x86-stub.c

   351	
   352	void __noreturn efi_stub_entry(efi_handle_t handle,
   353				       efi_system_table_t *sys_table_arg,
   354				       struct boot_params *boot_params);
   355	
   356	/*
   357	 * Because the x86 boot code expects to be passed a boot_params we
   358	 * need to create one ourselves (usually the bootloader would create
   359	 * one for us).
   360	 */
   361	efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
   362					   efi_system_table_t *sys_table_arg)
   363	{
   364		struct boot_params *boot_params;
   365		struct setup_header *hdr;
   366		efi_loaded_image_t *image;
   367		void *image_base;
   368		efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
   369		int options_size = 0;
   370		efi_status_t status;
   371		char *cmdline_ptr;
   372		unsigned long ramdisk_addr;
   373		unsigned long ramdisk_size;
   374	
   375		efi_system_table = sys_table_arg;
   376	
   377		/* Check if we were booted by the EFI firmware */
   378		if (efi_system_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
   379			efi_exit(handle, EFI_INVALID_PARAMETER);
   380	
   381		status = efi_bs_call(handle_protocol, handle, &proto, (void **)&image);
   382		if (status != EFI_SUCCESS) {
   383			efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
   384			efi_exit(handle, status);
   385		}
   386	
   387		image_base = efi_table_attr(image, image_base);
   388		image_offset = (void *)startup_32 - image_base;
   389	
   390		status = efi_allocate_pages(0x4000, (unsigned long *)&boot_params, ULONG_MAX);
   391		if (status != EFI_SUCCESS) {
   392			efi_printk("Failed to allocate lowmem for boot params\n");
   393			efi_exit(handle, status);
   394		}
   395	
   396		memset(boot_params, 0x0, 0x4000);
   397	
   398		hdr = &boot_params->hdr;
   399	
   400		/* Copy the second sector to boot_params */
   401		memcpy(&hdr->jump, image_base + 512, 512);
   402	
   403		/*
   404		 * Fill out some of the header fields ourselves because the
   405		 * EFI firmware loader doesn't load the first sector.
   406		 */
   407		hdr->root_flags	= 1;
   408		hdr->vid_mode	= 0xffff;
   409		hdr->boot_flag	= 0xAA55;
   410	
   411		hdr->type_of_loader = 0x21;
   412	
   413		/* Convert unicode cmdline to ascii */
   414		cmdline_ptr = efi_convert_cmdline(image, &options_size, ULONG_MAX);
   415		if (!cmdline_ptr)
   416			goto fail;
   417	
   418		hdr->cmd_line_ptr = (unsigned long)cmdline_ptr;
   419		/* Fill in upper bits of command line address, NOP on 32 bit  */
   420		boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32;
   421	
   422		hdr->ramdisk_image = 0;
   423		hdr->ramdisk_size = 0;
   424	
   425		if (efi_is_native()) {
   426			status = efi_parse_options(cmdline_ptr);
   427			if (status != EFI_SUCCESS)
   428				goto fail2;
   429	
   430			if (!noinitrd()) {
   431				status = efi_load_initrd(image, &ramdisk_addr,
   432							 &ramdisk_size,
   433							 hdr->initrd_addr_max,
   434							 ULONG_MAX);
   435				if (status != EFI_SUCCESS)
   436					goto fail2;
   437				hdr->ramdisk_image = ramdisk_addr & 0xffffffff;
   438				hdr->ramdisk_size  = ramdisk_size & 0xffffffff;
   439				boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32;
   440				boot_params->ext_ramdisk_size  = (u64)ramdisk_size >> 32;
   441			}
   442		}
   443	
 > 444		efi_stub_entry(handle, efi_system_table, boot_params);
   445		/* not reached */
   446	
   447	fail2:
   448		efi_free(options_size, (unsigned long)cmdline_ptr);
   449	fail:
   450		efi_free(0x4000, (unsigned long)boot_params);
   451	
   452		efi_exit(handle, status);
   453	}
   454	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

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