From patchwork Tue Apr 23 15:12:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640213 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 0DFA0C4345F for ; Tue, 23 Apr 2024 15:13:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710789.1110249 (Exim 4.92) (envelope-from ) id 1rzHpT-00059h-Ag; Tue, 23 Apr 2024 15:13:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710789.1110249; Tue, 23 Apr 2024 15:13:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpT-00059a-7l; Tue, 23 Apr 2024 15:13:07 +0000 Received: by outflank-mailman (input) for mailman id 710789; Tue, 23 Apr 2024 15:13:06 +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 1rzHpS-0003wh-1w for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:06 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fb56fa57-0183-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 17:13:04 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 872D54EE073F; Tue, 23 Apr 2024 17:13:00 +0200 (CEST) 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: fb56fa57-0183-11ef-b4bb-af5377834399 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Andrew Cooper , George Dunlap , Jan Beulich Subject: [XEN PATCH 01/10] libelf: address violations of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:43 +0200 Message-Id: <250b556fc0516e4a20b24161dad3032e2ac3db80.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/common/libelf/libelf-private.h | 2 +- xen/include/xen/libelf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-private.h index 98cac65bc50d..197d7a7623a3 100644 --- a/xen/common/libelf/libelf-private.h +++ b/xen/common/libelf/libelf-private.h @@ -26,7 +26,7 @@ /* we would like to use elf->log_callback but we can't because * there is no vprintk in Xen */ #define elf_msg(elf, fmt, args ... ) \ - if (elf->verbose) printk(fmt, ## args ) + if ((elf)->verbose) printk(fmt, ## args ) #define elf_err(elf, fmt, args ... ) \ printk(fmt, ## args ) diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h index 9ac530acc2a8..a0675a4dc352 100644 --- a/xen/include/xen/libelf.h +++ b/xen/include/xen/libelf.h @@ -288,7 +288,7 @@ bool elf_access_ok(struct elf_binary * elf, #define elf_store_val(elf, type, ptr, val) \ ({ \ typeof(type) elf_store__val = (val); \ - elf_ptrval elf_store__targ = ptr; \ + elf_ptrval elf_store__targ = (ptr); \ if (elf_access_ok((elf), elf_store__targ, \ sizeof(elf_store__val))) { \ elf_memcpy_unchecked((void*)elf_store__targ, &elf_store__val, \ From patchwork Tue Apr 23 15:12:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640215 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 19749C4345F for ; Tue, 23 Apr 2024 15:13:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710790.1110259 (Exim 4.92) (envelope-from ) id 1rzHpV-0005R9-IP; Tue, 23 Apr 2024 15:13:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710790.1110259; Tue, 23 Apr 2024 15:13: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 1rzHpV-0005Ql-FM; Tue, 23 Apr 2024 15:13:09 +0000 Received: by outflank-mailman (input) for mailman id 710790; Tue, 23 Apr 2024 15:13: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 1rzHpT-0004ry-VY for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:07 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fd4867f2-0183-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:07 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 8ED0A4EE0742; Tue, 23 Apr 2024 17:13:04 +0200 (CEST) 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: fd4867f2-0183-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Andrew Cooper , George Dunlap , Jan Beulich Subject: [XEN PATCH 02/10] xen/page-defs: address violation of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:44 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/include/xen/page-defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/include/xen/page-defs.h b/xen/include/xen/page-defs.h index 540f8b0b6452..682da6b7b476 100644 --- a/xen/include/xen/page-defs.h +++ b/xen/include/xen/page-defs.h @@ -4,7 +4,8 @@ /* Helpers for different page granularities. */ #define PAGE_SIZE_GRAN(gran) ((paddr_t)1 << PAGE_SHIFT_##gran) #define PAGE_MASK_GRAN(gran) (-PAGE_SIZE_GRAN(gran)) -#define PAGE_ALIGN_GRAN(gran, addr) ((addr + ~PAGE_MASK_##gran) & PAGE_MASK_##gran) +#define PAGE_ALIGN_GRAN(gran, addr) (((addr) + ~PAGE_MASK_##gran) & \ + PAGE_MASK_##gran) #define PAGE_SHIFT_4K 12 #define PAGE_SIZE_4K PAGE_SIZE_GRAN(4K) From patchwork Tue Apr 23 15:12:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640216 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 E34FCC4345F for ; Tue, 23 Apr 2024 15:13:21 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710791.1110268 (Exim 4.92) (envelope-from ) id 1rzHpa-0005my-Q3; Tue, 23 Apr 2024 15:13:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710791.1110268; Tue, 23 Apr 2024 15:13:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpa-0005mq-NR; Tue, 23 Apr 2024 15:13:14 +0000 Received: by outflank-mailman (input) for mailman id 710791; Tue, 23 Apr 2024 15:13:12 +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 1rzHpY-0003wh-IB for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:12 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ff489b4c-0183-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 17:13:10 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 9A8144EE073E; Tue, 23 Apr 2024 17:13:07 +0200 (CEST) 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: ff489b4c-0183-11ef-b4bb-af5377834399 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich Subject: [XEN PATCH 03/10] automation/eclair_analysis: deviate macro count_args_ for MISRA Rule 20.7 Date: Tue, 23 Apr 2024 17:12:45 +0200 Message-Id: <7de407c218f0911e28b7c3f609a55636165166a8.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 The count_args_ macro violates Rule 20.7, but it can't be made compliant with Rule 20.7 without breaking its functionality. Since it's very unlikely for this macro to be misused, it is deviated. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++ docs/misra/deviations.rst | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index d21f112a9b94..c17e2f5a0886 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -445,6 +445,12 @@ not to parenthesize their arguments." -config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"} -doc_end +-doc_begin="The argument 'x' of the count_args_ macro can't be parenthesized as +the rule would require, without breaking the functionality of the macro. The uses +of this macro do not lead to developer confusion, and can thus be deviated." +-config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"} +-doc_end + -doc_begin="Uses of variadic macros that have one of their arguments defined as a macro and used within the body for both ordinary parameter expansion and as an operand to the # or ## operators have a behavior that is well-understood and diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index ed0c1e8ed0bf..e228ae2e715f 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -371,6 +371,12 @@ Deviations related to MISRA C:2012 Rules: sanity checks in place. - Tagged as `safe` for ECLAIR. + * - R20.7 + - The macro `count_args_` is not compliant with the rule, but is not likely + to incur in the risk of being misused or lead to developer confusion, and + refactoring it to add parentheses breaks its functionality. + - Tagged as `safe` for ECLAIR. + * - R20.12 - Variadic macros that use token pasting often employ the gcc extension `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is From patchwork Tue Apr 23 15:12:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640217 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 09D2CC04FFE for ; Tue, 23 Apr 2024 15:13:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710792.1110275 (Exim 4.92) (envelope-from ) id 1rzHpb-0005sX-9c; Tue, 23 Apr 2024 15:13:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710792.1110275; Tue, 23 Apr 2024 15:13:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpb-0005rp-5Z; Tue, 23 Apr 2024 15:13:15 +0000 Received: by outflank-mailman (input) for mailman id 710792; Tue, 23 Apr 2024 15:13:14 +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 1rzHpa-0004ry-JA for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0138d2f3-0184-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:14 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 0286B4EE073F; Tue, 23 Apr 2024 17:13:10 +0200 (CEST) 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: 0138d2f3-0184-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Volodymyr Babchuk Subject: [XEN PATCH 04/10] drivers: char: address violation of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:46 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional chage. Signed-off-by: Nicola Vetrini --- xen/drivers/char/omap-uart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c index 03b5b66e7acb..9e1abf306ace 100644 --- a/xen/drivers/char/omap-uart.c +++ b/xen/drivers/char/omap-uart.c @@ -48,8 +48,9 @@ /* System configuration register */ #define UART_OMAP_SYSC_DEF_CONF 0x0d /* autoidle mode, wakeup is enabled */ -#define omap_read(uart, off) readl((uart)->regs + (off<regs + (off<regs + ((off) << REG_SHIFT)) +#define omap_write(uart, off, val) writel((val), (uart)->regs + \ + ((off) << REG_SHIFT)) static struct omap_uart { u32 baud, clock_hz, data_bits, parity, stop_bits, fifo_size; From patchwork Tue Apr 23 15:12:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640218 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 3793AC4345F for ; Tue, 23 Apr 2024 15:13:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710793.1110288 (Exim 4.92) (envelope-from ) id 1rzHpg-0006XA-GQ; Tue, 23 Apr 2024 15:13:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710793.1110288; Tue, 23 Apr 2024 15:13:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpg-0006X1-DV; Tue, 23 Apr 2024 15:13:20 +0000 Received: by outflank-mailman (input) for mailman id 710793; Tue, 23 Apr 2024 15:13:19 +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 1rzHpf-0003wh-7J for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:19 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0365ff2f-0184-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 17:13:17 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 12D364EE073C; Tue, 23 Apr 2024 17:13:13 +0200 (CEST) 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: 0365ff2f-0184-11ef-b4bb-af5377834399 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Andrew Cooper , George Dunlap , Jan Beulich Subject: [XEN PATCH 05/10] xen/spinlock: address violations of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:47 +0200 Message-Id: <620466b08df1efb706e757aee05a8d7f7e6e8f4a.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/common/spinlock.c | 2 +- xen/include/xen/spinlock.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 5aa9ba618859..558ea7ac3518 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -269,7 +269,7 @@ void spin_debug_disable(void) profile->lock_cnt++; \ } #define LOCK_PROFILE_VAR(var, val) s_time_t var = (val) -#define LOCK_PROFILE_BLOCK(var) var = var ? : NOW() +#define LOCK_PROFILE_BLOCK(var) (var) = (var) ? : NOW() #define LOCK_PROFILE_BLKACC(tst, val) \ if ( tst ) \ { \ diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 18793c5e29cb..8825affb25ca 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -141,7 +141,7 @@ struct lock_profile_qhead { } \ prof->name = #l; \ prof->ptr.lockptr = &(s)->l; \ - prof->is_rlock = isr; \ + prof->is_rlock = (isr); \ prof->next = (s)->profile_head.elem_q; \ (s)->profile_head.elem_q = prof; \ } while( 0 ) From patchwork Tue Apr 23 15:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640219 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 A77B6C10F1A for ; Tue, 23 Apr 2024 15:13:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710794.1110299 (Exim 4.92) (envelope-from ) id 1rzHpi-0006sR-O5; Tue, 23 Apr 2024 15:13:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710794.1110299; Tue, 23 Apr 2024 15:13:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpi-0006sI-Jw; Tue, 23 Apr 2024 15:13:22 +0000 Received: by outflank-mailman (input) for mailman id 710794; Tue, 23 Apr 2024 15:13:21 +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 1rzHph-0004ry-6g for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:21 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 052aa59f-0184-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:20 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id ED6784EE0742; Tue, 23 Apr 2024 17:13:17 +0200 (CEST) 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: 052aa59f-0184-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [XEN PATCH 06/10] x86/pci: address violation of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:48 +0200 Message-Id: <6c8bb550a4e263c8052ac10433070d2fcc7f56ad.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/include/asm/pci.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/pci.h b/xen/arch/x86/include/asm/pci.h index 6bfe87e2780b..fd5480d67d43 100644 --- a/xen/arch/x86/include/asm/pci.h +++ b/xen/arch/x86/include/asm/pci.h @@ -8,10 +8,10 @@ #define CF8_ADDR_HI(cf8) ( ((cf8) & 0x0f000000U) >> 16) #define CF8_ENABLED(cf8) (!!((cf8) & 0x80000000U)) -#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 \ - || id == 0x01268086 || id == 0x01028086 \ - || id == 0x01128086 || id == 0x01228086 \ - || id == 0x010A8086 ) +#define IS_SNB_GFX(id) ((id) == 0x01068086 || (id) == 0x01168086 \ + || (id) == 0x01268086 || (id) == 0x01028086 \ + || (id) == 0x01128086 || (id) == 0x01228086 \ + || (id) == 0x010A8086 ) struct arch_pci_dev { vmask_t used_vectors; From patchwork Tue Apr 23 15:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640220 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 6CD07C4345F for ; Tue, 23 Apr 2024 15:13:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710797.1110308 (Exim 4.92) (envelope-from ) id 1rzHpl-0007LW-VC; Tue, 23 Apr 2024 15:13:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710797.1110308; Tue, 23 Apr 2024 15:13:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpl-0007Kt-S4; Tue, 23 Apr 2024 15:13:25 +0000 Received: by outflank-mailman (input) for mailman id 710797; Tue, 23 Apr 2024 15:13:23 +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 1rzHpj-0004ry-So for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:23 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 06c360e2-0184-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:23 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id CE74D4EE073F; Tue, 23 Apr 2024 17:13:20 +0200 (CEST) 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: 06c360e2-0184-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [XEN PATCH 07/10] x86/acpi: power: address violations of MISRA Rule 20.7 Date: Tue, 23 Apr 2024 17:12:49 +0200 Message-Id: <9f159a0c653c3fb9dd192c1f888a16052f1b026f.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/acpi/power.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index c6fa810a6b13..610937f42e95 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -422,12 +422,12 @@ static void tboot_sleep(u8 sleep_state) { uint32_t shutdown_type; -#define TB_COPY_GAS(tbg, g) \ - tbg.space_id = g.space_id; \ - tbg.bit_width = g.bit_width; \ - tbg.bit_offset = g.bit_offset; \ - tbg.access_width = g.access_width; \ - tbg.address = g.address; +#define TB_COPY_GAS(tbg, g) \ + (tbg).space_id = (g).space_id; \ + (tbg).bit_width = (g).bit_width; \ + (tbg).bit_offset = (g).bit_offset; \ + (tbg).access_width = (g).access_width; \ + (tbg).address = (g).address; /* sizes are not same (due to packing) so copy each one */ TB_COPY_GAS(g_tboot_shared->acpi_sinfo.pm1a_cnt_blk, From patchwork Tue Apr 23 15:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640298 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 1629DC10F1A for ; Tue, 23 Apr 2024 15:27:22 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710852.1110399 (Exim 4.92) (envelope-from ) id 1rzI37-0000At-HL; Tue, 23 Apr 2024 15:27:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710852.1110399; Tue, 23 Apr 2024 15:27:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzI37-0000Am-DE; Tue, 23 Apr 2024 15:27:13 +0000 Received: by outflank-mailman (input) for mailman id 710852; Tue, 23 Apr 2024 15:27:13 +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 1rzHpn-0003wh-DE for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:27 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0846565a-0184-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 17:13:25 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 489C74EE0743; Tue, 23 Apr 2024 17:13:23 +0200 (CEST) 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: 0846565a-0184-11ef-b4bb-af5377834399 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [XEN PATCH 08/10] x86/hvm: hpet: address violations of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:50 +0200 Message-Id: <063ad5abee7765a921fd7f68372a4d7fe0e04e54.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/hvm/hpet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index 1db9c0b60ee0..5f456221cbfb 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -43,11 +43,11 @@ ((s_time_t)((((tick) > (h)->hpet_to_ns_limit) ? \ ~0ULL : (tick) * (h)->hpet_to_ns_scale) >> 10)) -#define timer_config(h, n) (h->hpet.timers[n].config) +#define timer_config(h, n) ((h)->hpet.timers[n].config) #define timer_enabled(h, n) (timer_config(h, n) & HPET_TN_ENABLE) #define timer_is_periodic(h, n) (timer_config(h, n) & HPET_TN_PERIODIC) #define timer_is_32bit(h, n) (timer_config(h, n) & HPET_TN_32BIT) -#define hpet_enabled(h) (h->hpet.config & HPET_CFG_ENABLE) +#define hpet_enabled(h) ((h)->hpet.config & HPET_CFG_ENABLE) #define timer_level(h, n) (timer_config(h, n) & HPET_TN_LEVEL) #define timer_int_route(h, n) MASK_EXTR(timer_config(h, n), HPET_TN_ROUTE) From patchwork Tue Apr 23 15:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640221 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 5830DC4345F for ; Tue, 23 Apr 2024 15:13:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710798.1110319 (Exim 4.92) (envelope-from ) id 1rzHpp-0007nh-9v; Tue, 23 Apr 2024 15:13:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710798.1110319; Tue, 23 Apr 2024 15:13:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpp-0007nV-6U; Tue, 23 Apr 2024 15:13:29 +0000 Received: by outflank-mailman (input) for mailman id 710798; Tue, 23 Apr 2024 15:13:27 +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 1rzHpn-0004ry-Sa for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:27 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 09270cd6-0184-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:27 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 0FD9E4EE0742; Tue, 23 Apr 2024 17:13:25 +0200 (CEST) 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: 09270cd6-0184-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [XEN PATCH 09/10] x86/debugreg: address violation of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:51 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/include/asm/debugreg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h index 2bdaf5d9aa11..96c406ad53c8 100644 --- a/xen/arch/x86/include/asm/debugreg.h +++ b/xen/arch/x86/include/asm/debugreg.h @@ -67,7 +67,7 @@ #define DR_GENERAL_DETECT (0x00002000UL) /* General detect enable */ #define write_debugreg(reg, val) do { \ - unsigned long __val = val; \ + unsigned long __val = (val); \ asm volatile ( "mov %0,%%db" #reg : : "r" (__val) ); \ } while (0) #define read_debugreg(reg) ({ \ From patchwork Tue Apr 23 15:12:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13640222 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 639D0C04FFE for ; Tue, 23 Apr 2024 15:13:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710799.1110328 (Exim 4.92) (envelope-from ) id 1rzHpq-00089L-JU; Tue, 23 Apr 2024 15:13:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710799.1110328; Tue, 23 Apr 2024 15:13:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHpq-00088U-FR; Tue, 23 Apr 2024 15:13:30 +0000 Received: by outflank-mailman (input) for mailman id 710799; Tue, 23 Apr 2024 15:13:28 +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 1rzHpo-0004ry-Ss for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 15:13:28 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 098faf24-0184-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 17:13:28 +0200 (CEST) Received: from nico.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 4A6434EE073F; Tue, 23 Apr 2024 17:13:27 +0200 (CEST) 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: 098faf24-0184-11ef-909a-e314d9c70b13 From: Nicola Vetrini To: xen-devel@lists.xenproject.org, nicola.vetrini@bugseng.com Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org, Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [XEN PATCH 10/10] x86/mm: address violations of MISRA C Rule 20.7 Date: Tue, 23 Apr 2024 17:12:52 +0200 Message-Id: <067c2c22f84f7d1ed1c89d65859f70ac2fd7610a.1713885065.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 9141912ae52d..87529db7d136 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -162,7 +162,7 @@ static uint32_t base_disallow_mask; #define L4_DISALLOW_MASK (base_disallow_mask) #define l1_disallow_mask(d) \ - ((d != dom_io) && \ + (((d) != dom_io) && \ (rangeset_is_empty((d)->iomem_caps) && \ rangeset_is_empty((d)->arch.ioport_caps) && \ !has_arch_pdevs(d) && \