From patchwork Fri Nov 24 16:29:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13467859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A74BC61DF4 for ; Fri, 24 Nov 2023 16:30:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.640821.999534 (Exim 4.92) (envelope-from ) id 1r6Z4D-00018x-NQ; Fri, 24 Nov 2023 16:30:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 640821.999534; Fri, 24 Nov 2023 16:30:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6Z4D-00018q-Ku; Fri, 24 Nov 2023 16:30:09 +0000 Received: by outflank-mailman (input) for mailman id 640821; Fri, 24 Nov 2023 16:30:08 +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 1r6Z4C-00015K-Eg for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 16:30:08 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ba5f5af2-8ae6-11ee-98e2-6d05b1d4d9a1; Fri, 24 Nov 2023 17:30:07 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 5D1244EE0740; Fri, 24 Nov 2023 17:30:06 +0100 (CET) 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: ba5f5af2-8ae6-11ee-98e2-6d05b1d4d9a1 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Simone Ballarin Subject: [PATCH 1/5] x86/platform_hypercall: address violations of MISRA C:2012 Rule 11.8 Date: Fri, 24 Nov 2023 17:29:15 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add const qualifier in cast that unnecessarily removes it to comply with Rule 11.8. The variable info is declared with a const qualified type. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/x86/platform_hypercall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index c1ab552c57..4dde71db27 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -364,7 +364,7 @@ ret_t do_platform_op( if ( length > info->edd_device_params.length ) length = info->edd_device_params.length; if ( copy_to_compat(op->u.firmware_info.u.disk_info.edd_params, - (u8 *)&info->edd_device_params, + (const uint8_t *)&info->edd_device_params, length) ) break; if ( copy_to_compat(op->u.firmware_info.u.disk_info.edd_params, From patchwork Fri Nov 24 16:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13467860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70D15C61DF4 for ; Fri, 24 Nov 2023 16:30:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.640822.999545 (Exim 4.92) (envelope-from ) id 1r6Z4E-0001OQ-W2; Fri, 24 Nov 2023 16:30:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 640822.999545; Fri, 24 Nov 2023 16:30:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6Z4E-0001OJ-T9; Fri, 24 Nov 2023 16:30:10 +0000 Received: by outflank-mailman (input) for mailman id 640822; Fri, 24 Nov 2023 16:30:09 +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 1r6Z4D-0000du-2z for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 16:30:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bab67beb-8ae6-11ee-9b0e-b553b5be7939; Fri, 24 Nov 2023 17:30:07 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id E8B374EE0C89; Fri, 24 Nov 2023 17:30:06 +0100 (CET) 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: bab67beb-8ae6-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Simone Ballarin Subject: [PATCH 2/5] x86/boot/reloc: address violations of MISRA C:2012 Rule 11.8 Date: Fri, 24 Nov 2023 17:29:16 +0100 Message-Id: <0e82b0a844e6eb50860ba5c9a2fcdb3328bc374f.1700842832.git.maria.celeste.cesario@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add missing const qualifier in casting to comply with Rule 11.8. Argument tag is typically const qualified. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index e093b7389c..df0bc710a7 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -67,7 +67,7 @@ struct vesa_mode_info { }; #endif /* CONFIG_VIDEO */ -#define get_mb2_data(tag, type, member) (((multiboot2_tag_##type##_t *)(tag))->member) +#define get_mb2_data(tag, type, member) (((const multiboot2_tag_##type##_t *)(tag))->member) #define get_mb2_string(tag, type, member) ((u32)get_mb2_data(tag, type, member)) static u32 alloc; From patchwork Fri Nov 24 16:29:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13467861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D0BEC61D97 for ; Fri, 24 Nov 2023 16:30:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.640824.999555 (Exim 4.92) (envelope-from ) id 1r6Z4F-0001Yh-Me; Fri, 24 Nov 2023 16:30:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 640824.999555; Fri, 24 Nov 2023 16:30:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6Z4F-0001Xc-Gi; Fri, 24 Nov 2023 16:30:11 +0000 Received: by outflank-mailman (input) for mailman id 640824; Fri, 24 Nov 2023 16:30:10 +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 1r6Z4E-0000du-3C for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 16:30:10 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id baffe575-8ae6-11ee-9b0e-b553b5be7939; Fri, 24 Nov 2023 17:30:08 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 810044EE0747; Fri, 24 Nov 2023 17:30:07 +0100 (CET) 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: baffe575-8ae6-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com, Jan Beulich , Andrew Cooper , Simone Ballarin Subject: [PATCH 3/5] AMD/IOMMU: address violations of MISRA C:2012 Rule 11.8 Date: Fri, 24 Nov 2023 17:29:17 +0100 Message-Id: <11fc193f35be188165294665b1e989b2db17a776.1700842832.git.maria.celeste.cesario@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add missing const qualifier in casting to comply with Rule 11.8. The type of the formal parameter ivhd_block is const qualified. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c index 699d33f429..00923a6bb5 100644 --- a/xen/drivers/passthrough/amd/iommu_acpi.c +++ b/xen/drivers/passthrough/amd/iommu_acpi.c @@ -1232,7 +1232,7 @@ static int __init get_last_bdf_ivhd( while ( ivhd_block->header.length >= (block_length + sizeof(struct acpi_ivrs_de_header)) ) { - ivhd_device = (const void *)((u8 *)ivhd_block + block_length); + ivhd_device = (const void *)((const uint8_t *)ivhd_block + block_length); switch ( ivhd_device->header.type ) { From patchwork Fri Nov 24 16:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13467857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09E5EC61D97 for ; Fri, 24 Nov 2023 16:30:21 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.640825.999575 (Exim 4.92) (envelope-from ) id 1r6Z4G-00026c-VC; Fri, 24 Nov 2023 16:30:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 640825.999575; Fri, 24 Nov 2023 16:30:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6Z4G-00024o-OQ; Fri, 24 Nov 2023 16:30:12 +0000 Received: by outflank-mailman (input) for mailman id 640825; Fri, 24 Nov 2023 16:30:11 +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 1r6Z4F-0000du-3X for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 16:30:11 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bb561178-8ae6-11ee-9b0e-b553b5be7939; Fri, 24 Nov 2023 17:30:08 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 003AA4EE0C8F; Fri, 24 Nov 2023 17:30:07 +0100 (CET) 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: bb561178-8ae6-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Simone Ballarin Subject: [PATCH 4/5] x86/atomic: address violations of MISRA C:2012 Rule 11.8 Date: Fri, 24 Nov 2023 17:29:18 +0100 Message-Id: <0224699e85baac395e47a1d5d89972d9d0284e85.1700842832.git.maria.celeste.cesario@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Edit casts that unnecessarily remove const qualifiers to comply with Rule 11.8. The type of the provided pointer may be const qualified. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/x86/include/asm/atomic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/atomic.h b/xen/arch/x86/include/asm/atomic.h index 27aad43aaa..16bd0ebfd7 100644 --- a/xen/arch/x86/include/asm/atomic.h +++ b/xen/arch/x86/include/asm/atomic.h @@ -51,10 +51,10 @@ void __bad_atomic_size(void); unsigned long x_; \ CLANG_DISABLE_WARN_GCC_COMPAT_START \ switch ( sizeof(*(p)) ) { \ - case 1: x_ = read_u8_atomic((uint8_t *)(p)); break; \ - case 2: x_ = read_u16_atomic((uint16_t *)(p)); break; \ - case 4: x_ = read_u32_atomic((uint32_t *)(p)); break; \ - case 8: x_ = read_u64_atomic((uint64_t *)(p)); break; \ + case 1: x_ = read_u8_atomic((const uint8_t *)(p)); break; \ + case 2: x_ = read_u16_atomic((const uint16_t *)(p)); break; \ + case 4: x_ = read_u32_atomic((const uint32_t *)(p)); break; \ + case 8: x_ = read_u64_atomic((const uint64_t *)(p)); break; \ default: x_ = 0; __bad_atomic_size(); break; \ } \ CLANG_DISABLE_WARN_GCC_COMPAT_END \ From patchwork Fri Nov 24 16:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13467858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55BEBC636CB for ; Fri, 24 Nov 2023 16:30:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.640823.999550 (Exim 4.92) (envelope-from ) id 1r6Z4F-0001Qm-CJ; Fri, 24 Nov 2023 16:30:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 640823.999550; Fri, 24 Nov 2023 16:30:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6Z4F-0001Q3-4P; Fri, 24 Nov 2023 16:30:11 +0000 Received: by outflank-mailman (input) for mailman id 640823; Fri, 24 Nov 2023 16:30:09 +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 1r6Z4D-00015K-Px for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 16:30:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bbb43385-8ae6-11ee-98e2-6d05b1d4d9a1; Fri, 24 Nov 2023 17:30:09 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 8B8CF4EE074E; Fri, 24 Nov 2023 17:30:08 +0100 (CET) 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: bbb43385-8ae6-11ee-98e2-6d05b1d4d9a1 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com, Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Simone Ballarin Subject: [PATCH 5/5] xen/arm: address violations of MISRA C:2012 Rule 11.8 Date: Fri, 24 Nov 2023 17:29:19 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add or amend casts to comply with Rule 11.8. The violations are resolved either: - by adding a missing const qualifier in the cast - by removing a cast to non-const on a const-qualified object No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/arm/domain_build.c | 2 +- xen/arch/arm/include/asm/atomic.h | 2 +- xen/arch/arm/include/asm/regs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 2dd2926b41..c17214f738 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2749,7 +2749,7 @@ static int __init handle_passthrough_prop(struct kernel_info *kinfo, if ( node == NULL ) { printk(XENLOG_ERR "Couldn't find node %s in host_dt!\n", - (char *)xen_path->data); + xen_path->data); return -EINVAL; } diff --git a/xen/arch/arm/include/asm/atomic.h b/xen/arch/arm/include/asm/atomic.h index 64314d59b3..517216d2a8 100644 --- a/xen/arch/arm/include/asm/atomic.h +++ b/xen/arch/arm/include/asm/atomic.h @@ -154,7 +154,7 @@ static always_inline void write_atomic_size(volatile void *p, */ static inline int atomic_read(const atomic_t *v) { - return *(volatile int *)&v->counter; + return *(const volatile int *)&v->counter; } static inline int _atomic_read(atomic_t v) diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h index 8a0db95415..79050937f3 100644 --- a/xen/arch/arm/include/asm/regs.h +++ b/xen/arch/arm/include/asm/regs.h @@ -48,7 +48,7 @@ static inline bool regs_mode_is_32bit(const struct cpu_user_regs *regs) static inline bool guest_mode(const struct cpu_user_regs *r) { - unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r); + unsigned long diff = (char *)guest_cpu_user_regs() - (const char *)(r); /* Frame pointer must point into current CPU stack. */ ASSERT(diff < STACK_SIZE); /* If not a guest frame, it must be a hypervisor frame. */