From nobody Mon Feb 9 04:22:54 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 1706887033053708.347353919077; Fri, 2 Feb 2024 07:17:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.675079.1050280 (Exim 4.92) (envelope-from ) id 1rVvHi-000724-8D; Fri, 02 Feb 2024 15:16:54 +0000 Received: by outflank-mailman (output) from mailman id 675079.1050280; Fri, 02 Feb 2024 15:16:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVvHi-00070O-1Z; Fri, 02 Feb 2024 15:16:54 +0000 Received: by outflank-mailman (input) for mailman id 675079; Fri, 02 Feb 2024 15:16:52 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVvHg-0005mR-HE for xen-devel@lists.xenproject.org; Fri, 02 Feb 2024 15:16:52 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 16da0948-c1de-11ee-98f5-efadbce2ee36; Fri, 02 Feb 2024 16:16:50 +0100 (CET) Received: from beta.station (net-188-218-67-100.cust.vodafonedsl.it [188.218.67.100]) by support.bugseng.com (Postfix) with ESMTPSA id 03D944EE0741; Fri, 2 Feb 2024 16:16:49 +0100 (CET) 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: 16da0948-c1de-11ee-98f5-efadbce2ee36 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH v4 3/4] xen/x86: address violations of MISRA C:2012 Rule 13.1 Date: Fri, 2 Feb 2024 16:16:04 +0100 Message-Id: <16bb514ac0a5fe0d6e9a2c95279a8200ff4495c6.1706886631.git.simone.ballarin@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: 1706887033388100001 Content-Type: text/plain; charset="utf-8" Rule 13.1: Initializer lists shall not contain persistent side effects This patch moves expressions with side-effects into new variables before the initializer lists. No functional changes. Signed-off-by: Simone Ballarin --- xen/arch/x86/io_apic.c | 9 ++++++--- xen/arch/x86/mpparse.c | 3 ++- xen/arch/x86/setup.c | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index b48a642465..4a6ab85689 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2559,9 +2559,12 @@ integer_param("max_gsi_irqs", max_gsi_irqs); =20 static __init bool bad_ioapic_register(unsigned int idx) { - union IO_APIC_reg_00 reg_00 =3D { .raw =3D io_apic_read(idx, 0) }; - union IO_APIC_reg_01 reg_01 =3D { .raw =3D io_apic_read(idx, 1) }; - union IO_APIC_reg_02 reg_02 =3D { .raw =3D io_apic_read(idx, 2) }; + uint32_t reg_00_raw =3D io_apic_read(idx, 0); + uint32_t reg_01_raw =3D io_apic_read(idx, 1); + uint32_t reg_02_raw =3D io_apic_read(idx, 2); + union IO_APIC_reg_00 reg_00 =3D { .raw =3D reg_00_raw }; + union IO_APIC_reg_01 reg_01 =3D { .raw =3D reg_01_raw }; + union IO_APIC_reg_02 reg_02 =3D { .raw =3D reg_02_raw }; =20 if ( reg_00.raw =3D=3D -1 && reg_01.raw =3D=3D -1 && reg_02.raw =3D=3D= -1 ) { diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c index d8ccab2449..81a819403b 100644 --- a/xen/arch/x86/mpparse.c +++ b/xen/arch/x86/mpparse.c @@ -798,11 +798,12 @@ void __init mp_register_lapic_address ( =20 int mp_register_lapic(u32 id, bool enabled, bool hotplug) { + u32 apic =3D apic_read(APIC_LVR); struct mpc_config_processor processor =3D { .mpc_type =3D MP_PROCESSOR, /* Note: We don't fill in fields not consumed anywhere. */ .mpc_apicid =3D id, - .mpc_apicver =3D GET_APIC_VERSION(apic_read(APIC_LVR)), + .mpc_apicver =3D GET_APIC_VERSION(apic), .mpc_cpuflag =3D (enabled ? CPU_ENABLED : 0) | (id =3D=3D boot_cpu_physical_apicid ? CPU_BOOTPROCESSOR : 0), diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ee682dd136..886031d86a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -885,13 +885,14 @@ static struct domain *__init create_dom0(const module= _t *image, { static char __initdata cmdline[MAX_GUEST_CMDLINE]; =20 + unsigned int max_vcpus =3D dom0_max_vcpus(); struct xen_domctl_createdomain dom0_cfg =3D { .flags =3D IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity = : 0, .max_evtchn_port =3D -1, .max_grant_frames =3D -1, .max_maptrack_frames =3D -1, .grant_opts =3D XEN_DOMCTL_GRANT_version(opt_gnttab_max_version), - .max_vcpus =3D dom0_max_vcpus(), + .max_vcpus =3D max_vcpus, .arch =3D { .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, --=20 2.34.1