From nobody Mon Feb 9 11:08:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690894138447417.48573853096764; Tue, 1 Aug 2023 05:48:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.574139.899342 (Exim 4.92) (envelope-from ) id 1qQong-0002hV-DB; Tue, 01 Aug 2023 12:48:32 +0000 Received: by outflank-mailman (output) from mailman id 574139.899342; Tue, 01 Aug 2023 12:48:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQong-0002eB-5B; Tue, 01 Aug 2023 12:48:32 +0000 Received: by outflank-mailman (input) for mailman id 574139; Tue, 01 Aug 2023 12:48:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQone-0002MS-Th for xen-devel@lists.xenproject.org; Tue, 01 Aug 2023 12:48:31 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b72c0eff-3069-11ee-b25a-6b7b168915f2; Tue, 01 Aug 2023 14:48:30 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 0193A4EE0743; Tue, 1 Aug 2023 14:48:28 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b72c0eff-3069-11ee-b25a-6b7b168915f2 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , "Daniel P. Smith" Subject: [XEN PATCH v2 3/3] arm/efi: address MISRA C:2012 Rule 5.3 Date: Tue, 1 Aug 2023 14:47:44 +0200 Message-Id: <688eea3584d537b6f41bb32f227f8be74ffd2783.1690893696.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690894140181100001 Content-Type: text/plain; charset="utf-8" Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" The file-scope variable 'fdt' is shadowed by function parameters, and thus violates the rule, hence it's renamed to 'fdt_efi' No functional changes. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v2: - Renamed the file-scope variable instead of removing function parameters. --- xen/arch/arm/efi/efi-boot.h | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 6126a71400..f24df2abb9 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -49,7 +49,7 @@ static void PrintMessage(const CHAR16 *s); {0xb1b621d5U, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0= xe0}} =20 static struct file __initdata dtbfile; -static void __initdata *fdt; +static void __initdata *fdt_efi; static void __initdata *memmap; =20 static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_= cells) @@ -383,7 +383,7 @@ static void __init efi_arch_process_memory_map(EFI_SYST= EM_TABLE *SystemTable, if ( EFI_ERROR(status) ) blexit(L"EFI memory map processing failed"); =20 - status =3D fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_si= ze, + status =3D fdt_add_uefi_nodes(SystemTable, fdt_efi, map, map_size, des= c_size, desc_ver); if ( EFI_ERROR(status) ) PrintErrMesg(L"Updating FDT failed", status); @@ -395,7 +395,7 @@ static void __init efi_arch_pre_exit_boot(void) =20 static void __init noreturn efi_arch_post_exit_boot(void) { - efi_xen_start(fdt, fdt_totalsize(fdt)); + efi_xen_start(fdt_efi, fdt_totalsize(fdt_efi)); } =20 static void __init efi_arch_cfg_file_early(const EFI_LOADED_IMAGE *image, @@ -420,8 +420,8 @@ static void __init efi_arch_cfg_file_early(const EFI_LO= ADED_IMAGE *image, efi_bs->FreePool(name.w); } } - fdt =3D fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); - if ( !fdt ) + fdt_efi =3D fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); + if ( !fdt_efi ) blexit(L"Unable to create new FDT"); } =20 @@ -465,7 +465,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, int chosen; =20 /* locate chosen node, which is where we add Xen module info. */ - chosen =3D fdt_subnode_offset(fdt, 0, "chosen"); + chosen =3D fdt_subnode_offset(fdt_efi, 0, "chosen"); if ( chosen < 0 ) blexit(L"Unable to find chosen node"); =20 @@ -498,7 +498,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, else { /* Get xen,xen-bootargs in /chosen if it is specified */ - const char *dt_bootargs_prop =3D fdt_getprop(fdt, chosen, + const char *dt_bootargs_prop =3D fdt_getprop(fdt_efi, chosen, "xen,xen-bootargs", NUL= L); if ( dt_bootargs_prop ) { @@ -526,7 +526,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, blexit(L"FDT string overflow"); } =20 - if ( fdt_setprop_string(fdt, chosen, "xen,xen-bootargs", buf) < 0 ) + if ( fdt_setprop_string(fdt_efi, chosen, "xen,xen-bootargs", buf) < 0 ) blexit(L"Unable to set xen,xen-bootargs property."); =20 efi_bs->FreePool(buf); @@ -542,7 +542,7 @@ static void __init efi_arch_handle_module(const struct = file *file, =20 if ( file =3D=3D &dtbfile ) return; - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(fdt_efi, &addr_len, &size_len); if ( chosen < 0 ) blexit(L"Unable to setup chosen node"); =20 @@ -551,13 +551,13 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst ramdisk_compat[] =3D "multiboot,ramd= isk\0" "multiboot,module= "; =20 - node =3D fdt_add_subnode(fdt, chosen, "ramdisk"); + node =3D fdt_add_subnode(fdt_efi, chosen, "ramdisk"); if ( node < 0 ) blexit(L"Unable to add ramdisk FDT node."); - if ( fdt_setprop(fdt, node, "compatible", ramdisk_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", ramdisk_compat, sizeof(ramdisk_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, ramdisk.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, ramdisk.addr, ramdisk.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -566,13 +566,13 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst xsm_compat[] =3D "xen,xsm-policy\0" "multiboot,module"; =20 - node =3D fdt_add_subnode(fdt, chosen, "xsm"); + node =3D fdt_add_subnode(fdt_efi, chosen, "xsm"); if ( node < 0 ) blexit(L"Unable to add xsm FDT node."); - if ( fdt_setprop(fdt, node, "compatible", xsm_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", xsm_compat, sizeof(xsm_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, xsm.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, xsm.addr, xsm.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -581,15 +581,15 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst kernel_compat[] =3D "multiboot,kerne= l\0" "multiboot,module"; =20 - node =3D fdt_add_subnode(fdt, chosen, "kernel"); + node =3D fdt_add_subnode(fdt_efi, chosen, "kernel"); if ( node < 0 ) blexit(L"Unable to add dom0 FDT node."); - if ( fdt_setprop(fdt, node, "compatible", kernel_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", kernel_compat, sizeof(kernel_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( options && fdt_setprop_string(fdt, node, "bootargs", options)= < 0 ) + if ( options && fdt_setprop_string(fdt_efi, node, "bootargs", opti= ons) < 0 ) blexit(L"Unable to set bootargs property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, kernel.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, kernel.addr, kernel.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -719,7 +719,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, module_info *file; =20 /* Check if the node is a multiboot,module otherwise return */ - module_compat =3D fdt_node_check_compatible(fdt, module_node_offset, + module_compat =3D fdt_node_check_compatible(fdt_efi, module_node_offse= t, "multiboot,module"); if ( module_compat < 0 ) /* Error while checking the compatible string */ @@ -730,7 +730,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, return 0; =20 /* Read xen,uefi-binary property to get the file name. */ - uefi_name_prop =3D fdt_getprop(fdt, module_node_offset, "xen,uefi-bina= ry", + uefi_name_prop =3D fdt_getprop(fdt_efi, module_node_offset, "xen,uefi-= binary", &uefi_name_len); =20 if ( !uefi_name_prop ) @@ -751,13 +751,13 @@ static int __init handle_module_node(const EFI_LOADED= _IMAGE *loaded_image, snprintf(mod_string, sizeof(mod_string), "module@%"PRIx64, file->addr); =20 /* Rename the module to be module@{address} */ - if ( fdt_set_name(fdt, module_node_offset, mod_string) < 0 ) + if ( fdt_set_name(fdt_efi, module_node_offset, mod_string) < 0 ) { PrintMessage(L"Unable to modify module node name."); return ERROR_RENAME_MODULE_NAME; } =20 - if ( fdt_set_reg(fdt, module_node_offset, reg_addr_cells, reg_size_cel= ls, + if ( fdt_set_reg(fdt_efi, module_node_offset, reg_addr_cells, reg_size= _cells, file->addr, file->size) < 0 ) { PrintMessage(L"Unable to set module reg property."); @@ -766,7 +766,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, =20 if ( !is_domu_module ) { - if ( (fdt_node_check_compatible(fdt, module_node_offset, + if ( (fdt_node_check_compatible(fdt_efi, module_node_offset, "multiboot,kernel") =3D=3D 0) ) { /* @@ -784,14 +784,14 @@ static int __init handle_module_node(const EFI_LOADED= _IMAGE *loaded_image, kernel.size =3D file->size; } else if ( ramdisk.addr && - (fdt_node_check_compatible(fdt, module_node_offset, + (fdt_node_check_compatible(fdt_efi, module_node_offset, "multiboot,ramdisk") =3D=3D 0= ) ) { PrintMessage(L"Dom0 ramdisk already found in cfg file."); return ERROR_DOM0_RAMDISK_FOUND; } else if ( xsm.addr && - (fdt_node_check_compatible(fdt, module_node_offset, + (fdt_node_check_compatible(fdt_efi, module_node_offset, "xen,xsm-policy") =3D=3D 0) ) { PrintMessage(L"XSM policy already found in cfg file."); @@ -816,7 +816,7 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima unsigned int mb_modules_found =3D 0; =20 /* Get #address-cells and #size-cells from domain node */ - prop =3D fdt_get_property(fdt, domain_node, "#address-cells", &len); + prop =3D fdt_get_property(fdt_efi, domain_node, "#address-cells", &len= ); if ( !prop ) { PrintMessage(L"#address-cells not found in domain node."); @@ -825,7 +825,7 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima =20 addr_cells =3D fdt32_to_cpu(*((uint32_t *)prop->data)); =20 - prop =3D fdt_get_property(fdt, domain_node, "#size-cells", &len); + prop =3D fdt_get_property(fdt_efi, domain_node, "#size-cells", &len); if ( !prop ) { PrintMessage(L"#size-cells not found in domain node."); @@ -835,9 +835,9 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima size_cells =3D fdt32_to_cpu(*((uint32_t *)prop->data)); =20 /* Check for nodes compatible with multiboot,module inside this node */ - for ( module_node =3D fdt_first_subnode(fdt, domain_node); + for ( module_node =3D fdt_first_subnode(fdt_efi, domain_node); module_node > 0; - module_node =3D fdt_next_subnode(fdt, module_node) ) + module_node =3D fdt_next_subnode(fdt_efi, module_node) ) { int ret =3D handle_module_node(loaded_image, dir_handle, module_no= de, addr_cells, size_cells, true); @@ -862,7 +862,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IM= AGE *loaded_image) EFI_FILE_HANDLE dir_handle =3D NULL; =20 /* Check for the chosen node in the current DTB */ - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(fdt_efi, &addr_len, &size_len); if ( chosen < 0 ) { PrintMessage(L"Unable to setup chosen node"); @@ -870,13 +870,13 @@ static int __init efi_check_dt_boot(const EFI_LOADED_= IMAGE *loaded_image) } =20 /* Check for nodes compatible with xen,domain under the chosen node */ - for ( node =3D fdt_first_subnode(fdt, chosen); + for ( node =3D fdt_first_subnode(fdt_efi, chosen); node > 0; - node =3D fdt_next_subnode(fdt, node) ) + node =3D fdt_next_subnode(fdt_efi, node) ) { int ret; =20 - if ( !fdt_node_check_compatible(fdt, node, "xen,domain") ) + if ( !fdt_node_check_compatible(fdt_efi, node, "xen,domain") ) { /* Found a node with compatible xen,domain; handle this node. = */ ret =3D handle_dom0less_domain_node(loaded_image, &dir_handle,= node); @@ -951,29 +951,29 @@ static bool __init efi_arch_use_config_file(EFI_SYSTE= M_TABLE *SystemTable) * node to decide whether to skip the UEFI Xen configuration file or n= ot. */ =20 - fdt =3D lookup_fdt_config_table(SystemTable); - dtbfile.ptr =3D fdt; + fdt_efi =3D lookup_fdt_config_table(SystemTable); + dtbfile.ptr =3D fdt_efi; dtbfile.need_to_free =3D false; /* Config table memory can't be freed.= */ =20 - if ( fdt && - (fdt_node_offset_by_compatible(fdt, 0, "multiboot,module") > 0) ) + if ( fdt_efi && + (fdt_node_offset_by_compatible(fdt_efi, 0, "multiboot,module") > = 0) ) { /* Locate chosen node */ - int node =3D fdt_subnode_offset(fdt, 0, "chosen"); + int node =3D fdt_subnode_offset(fdt_efi, 0, "chosen"); const void *cfg_load_prop; int cfg_load_len; =20 if ( node > 0 ) { /* Check if xen,uefi-cfg-load property exists */ - cfg_load_prop =3D fdt_getprop(fdt, node, "xen,uefi-cfg-load", + cfg_load_prop =3D fdt_getprop(fdt_efi, node, "xen,uefi-cfg-loa= d", &cfg_load_len); if ( !cfg_load_prop ) load_cfg_file =3D false; } } =20 - if ( !fdt || load_cfg_file ) + if ( !fdt_efi || load_cfg_file ) { /* * We either have no FDT, or one without modules, so we must have a @@ -983,7 +983,7 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_= TABLE *SystemTable) } PrintStr(L"Using modules provided by bootloader in FDT\r\n"); /* We have modules already defined in fdt, just add space. */ - fdt =3D fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); + fdt_efi =3D fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); =20 return false; } --=20 2.34.1