From patchwork Fri Mar 22 16:01: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: 13600279 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 74870C47DD9 for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696951.1088186 (Exim 4.92) (envelope-from ) id 1rnhLN-0000a5-SB; Fri, 22 Mar 2024 16:02:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696951.1088186; Fri, 22 Mar 2024 16:02: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 1rnhLN-0000Yk-NF; Fri, 22 Mar 2024 16:02:09 +0000 Received: by outflank-mailman (input) for mailman id 696951; Fri, 22 Mar 2024 16:02: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 1rnhLM-0000WB-Nu for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:08 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 881309f1-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:07 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 5419E4EE0C8A; Fri, 22 Mar 2024 17:02:05 +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: 881309f1-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap Subject: [XEN PATCH 01/11] xen/list: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:50 +0100 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 Reviewed-by: Jan Beulich --- Changes in v2: - changes to list.h are all in this patch; - Parenthesized some instances of "pos" and "n" even when already covered by the deviation on the lhs of an assingment for consistency. Changes in v3: - Added more parentheses that were missed. --- xen/include/xen/list.h | 143 ++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 72 deletions(-) diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h index b5eab3a1eb6c..6506ac40893b 100644 --- a/xen/include/xen/list.h +++ b/xen/include/xen/list.h @@ -452,7 +452,7 @@ static inline void list_splice_init(struct list_head *list, * @head: the head for your list. */ #define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) + for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next) /** * list_for_each_prev - iterate over a list backwards @@ -460,7 +460,7 @@ static inline void list_splice_init(struct list_head *list, * @head: the head for your list. */ #define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) + for ((pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev) /** * list_for_each_safe - iterate over a list safe against removal of list entry @@ -468,9 +468,9 @@ static inline void list_splice_init(struct list_head *list, * @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) +#define list_for_each_safe(pos, n, head) \ + for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (head); \ + (pos) = (n), (n) = (pos)->next) /** * list_for_each_backwards_safe - iterate backwards over a list safe @@ -479,9 +479,9 @@ static inline void list_splice_init(struct list_head *list, * @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_backwards_safe(pos, n, head) \ - for ( pos = (head)->prev, n = pos->prev; pos != (head); \ - pos = n, n = pos->prev ) +#define list_for_each_backwards_safe(pos, n, head) \ + for ( (pos) = (head)->prev, (n) = (pos)->prev; (pos) != (head); \ + (pos) = (n), (n) = (pos)->prev ) /** * list_for_each_entry - iterate over list of given type @@ -490,9 +490,9 @@ static inline void list_splice_init(struct list_head *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + for ((pos) = list_entry((head)->next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = list_entry((pos)->member.next, typeof(*(pos)), member)) /** * list_for_each_entry_reverse - iterate backwards over list of given type. @@ -501,9 +501,9 @@ static inline void list_splice_init(struct list_head *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + for ((pos) = list_entry((head)->prev, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = list_entry((pos)->member.prev, typeof(*(pos)), member)) /** * list_prepare_entry - prepare a pos entry for use in @@ -516,7 +516,7 @@ static inline void list_splice_init(struct list_head *list, * list_for_each_entry_continue. */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : list_entry(head, typeof(*(pos)), member)) /** * list_for_each_entry_continue - continue iteration over list of given type @@ -527,10 +527,10 @@ static inline void list_splice_init(struct list_head *list, * Continue to iterate over list of given type, continuing after * the current position. */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) +#define list_for_each_entry_continue(pos, head, member) \ + for ((pos) = list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = list_entry((pos)->member.next, typeof(*(pos)), member)) /** * list_for_each_entry_from - iterate over list of given type from the @@ -542,8 +542,8 @@ static inline void list_splice_init(struct list_head *list, * Iterate over list of given type, continuing from current position. */ #define list_for_each_entry_from(pos, head, member) \ - for (; &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + for (; &(pos)->member != (head); \ + (pos) = list_entry((pos)->member.next, typeof(*(pos)), member)) /** * list_for_each_entry_safe - iterate over list of given type safe @@ -554,10 +554,10 @@ static inline void list_splice_init(struct list_head *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + for ((pos) = list_entry((head)->next, typeof(*(pos)), member), \ + (n) = list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = (n), (n) = list_entry((n)->member.next, typeof(*(n)), member)) /** * list_for_each_entry_safe_continue @@ -569,11 +569,11 @@ static inline void list_splice_init(struct list_head *list, * Iterate over list of given type, continuing after current point, * safe against removal of list entry. */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) +#define list_for_each_entry_safe_continue(pos, n, head, member) \ + for ((pos) = list_entry((pos)->member.next, typeof(*(pos)), member), \ + (n) = list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = (n), (n) = list_entry((n)->member.next, typeof(*(n)), member)) /** * list_for_each_entry_safe_from @@ -586,9 +586,9 @@ static inline void list_splice_init(struct list_head *list, * removal of list entry. */ #define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + for ((n) = list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = (n), (n) = list_entry((n)->member.next, typeof(*(n)), member)) /** * list_for_each_entry_safe_reverse @@ -601,10 +601,10 @@ static inline void list_splice_init(struct list_head *list, * of list entry. */ #define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + for ((pos) = list_entry((head)->prev, typeof(*(pos)), member), \ + (n) = list_entry((pos)->member.prev, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + (pos) = (n), (n) = list_entry((n)->member.prev, typeof(*(n)), member)) /** * list_for_each_rcu - iterate over an rcu-protected list @@ -616,14 +616,14 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ + for ((pos) = (head)->next; \ rcu_dereference(pos) != (head); \ - pos = pos->next) + (pos) = (pos)->next) #define __list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ + for ((pos) = (head)->next; \ rcu_dereference(pos) != (head); \ - pos = pos->next) + (pos) = (pos)->next) /** * list_for_each_safe_rcu @@ -638,9 +638,9 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_safe_rcu(pos, n, head) \ - for (pos = (head)->next; \ - n = rcu_dereference(pos)->next, pos != (head); \ - pos = n) + for ((pos) = (head)->next; \ + (n) = rcu_dereference(pos)->next, (pos) != (head); \ + (pos) = (n)) /** * list_for_each_entry_rcu - iterate over rcu list of given type @@ -653,9 +653,9 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_entry_rcu(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ + for ((pos) = list_entry((head)->next, typeof(*(pos)), member); \ &rcu_dereference(pos)->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + (pos) = list_entry((pos)->member.next, typeof(*(pos)), member)) /** * list_for_each_continue_rcu @@ -899,11 +899,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, #define hlist_entry(ptr, type, member) container_of(ptr,type,member) #define hlist_for_each(pos, head) \ - for (pos = (head)->first; pos; pos = pos->next) + for ((pos) = (head)->first; (pos); (pos) = (pos)->next) -#define hlist_for_each_safe(pos, n, head) \ - for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ - pos = n) +#define hlist_for_each_safe(pos, n, head) \ + for ((pos) = (head)->first; (pos) && ({ (n) = (pos)->next; 1; }); \ + (pos) = (n)) /** * hlist_for_each_entry - iterate over list of given type @@ -913,10 +913,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry(tpos, pos, head, member) \ - for (pos = (head)->first; \ - pos && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) + for ((pos) = (head)->first; \ + (pos) && \ + ({ tpos = hlist_entry(pos, typeof(*(tpos)), member); 1;}); \ + (pos) = (pos)->next) /** * hlist_for_each_entry_continue - iterate over a hlist continuing @@ -925,11 +925,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, * @pos: the &struct hlist_node to use as a loop cursor. * @member: the name of the hlist_node within the struct. */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ - for (pos = (pos)->next; \ - pos && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) +#define hlist_for_each_entry_continue(tpos, pos, member) \ + for ((pos) = (pos)->next; \ + (pos) && \ + ({ tpos = hlist_entry(pos, typeof(*(tpos)), member); 1;}); \ + (pos) = (pos)->next) /** * hlist_for_each_entry_from - iterate over a hlist continuing from @@ -938,10 +938,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, * @pos: the &struct hlist_node to use as a loop cursor. * @member: the name of the hlist_node within the struct. */ -#define hlist_for_each_entry_from(tpos, pos, member) \ - for (; pos && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) +#define hlist_for_each_entry_from(tpos, pos, member) \ + for (; (pos) && \ + ({ tpos = hlist_entry(pos, typeof(*(tpos)), member); 1;}); \ + (pos) = (pos)->next) /** * hlist_for_each_entry_safe - iterate over list of given type safe @@ -952,11 +952,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, * @head: the head for your list. * @member: the name of the hlist_node within the struct. */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - for (pos = (head)->first; \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = n) +#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ + for ((pos) = (head)->first; \ + (pos) && ({ n = (pos)->next; 1; }) && \ + ({ tpos = hlist_entry(pos, typeof(*(tpos)), member); 1;}); \ + (pos) = (n)) /** @@ -971,10 +971,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, * as long as the traversal is guarded by rcu_read_lock(). */ #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ - for (pos = (head)->first; \ + for ((pos) = (head)->first; \ rcu_dereference(pos) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) + ({ tpos = hlist_entry(pos, typeof(*(tpos)), member); 1;}); \ + (pos) = (pos)->next) #endif /* __XEN_LIST_H__ */ - From patchwork Fri Mar 22 16:01: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: 13600282 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 7A9B5CD11DD for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696952.1088193 (Exim 4.92) (envelope-from ) id 1rnhLO-0000gh-6z; Fri, 22 Mar 2024 16:02:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696952.1088193; Fri, 22 Mar 2024 16:02: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 1rnhLO-0000fF-0K; Fri, 22 Mar 2024 16:02:10 +0000 Received: by outflank-mailman (input) for mailman id 696952; Fri, 22 Mar 2024 16:02: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 1rnhLN-0000WB-Cf for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 88dc9601-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:08 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id C955C4EE0C8D; Fri, 22 Mar 2024 17:02: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: 88dc9601-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, "Daniel P. Smith" Subject: [XEN PATCH 02/11] xen/xsm: add parentheses to comply with MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:51 +0100 Message-Id: <6cb601ef46a699f95eda0e10f4f9d15f1af4353e.1711118582.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 Reviewed-by: Stefano Stabellini Acked-by: Daniel P. Smith --- xen/include/xsm/dummy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 8671af1ba4d3..88039fdd227c 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -58,7 +58,7 @@ void __xsm_action_mismatch_detected(void); #define XSM_DEFAULT_ARG /* */ #define XSM_DEFAULT_VOID void -#define XSM_ASSERT_ACTION(def) xsm_default_t action = def; (void)action +#define XSM_ASSERT_ACTION(def) xsm_default_t action = (def); (void)action #else /* CONFIG_XSM */ @@ -71,7 +71,7 @@ void __xsm_action_mismatch_detected(void); #define XSM_INLINE always_inline #define XSM_DEFAULT_ARG xsm_default_t action, #define XSM_DEFAULT_VOID xsm_default_t action -#define XSM_ASSERT_ACTION(def) LINKER_BUG_ON(def != action) +#define XSM_ASSERT_ACTION(def) LINKER_BUG_ON((def) != action) #endif /* CONFIG_XSM */ From patchwork Fri Mar 22 16:01: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: 13600289 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 1BB4FCD1284 for ; Fri, 22 Mar 2024 16:02:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696953.1088211 (Exim 4.92) (envelope-from ) id 1rnhLP-0001DV-Ke; Fri, 22 Mar 2024 16:02:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696953.1088211; Fri, 22 Mar 2024 16:02: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 1rnhLP-0001DO-Fh; Fri, 22 Mar 2024 16:02:11 +0000 Received: by outflank-mailman (input) for mailman id 696953; Fri, 22 Mar 2024 16:02:10 +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 1rnhLO-0000WB-Cy for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:10 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 896d218f-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:09 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 32EEA4EE0C8F; Fri, 22 Mar 2024 17:02: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: 896d218f-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Volodymyr Babchuk Subject: [XEN PATCH 03/11] xen/efi: efibind: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:52 +0100 Message-Id: <9cadb45f9d200f3efbad0c5f602174728838d53e.1711118582.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 --- This file is matched by exclude-list.json, but the fix is rather trivial and impacts code that in under the scope of MISRA compliance. --- xen/arch/arm/include/asm/arm64/efibind.h | 4 ++-- xen/arch/x86/include/asm/x86_64/efibind.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/include/asm/arm64/efibind.h b/xen/arch/arm/include/asm/arm64/efibind.h index f13eadd4f0ab..a1323d452e2e 100644 --- a/xen/arch/arm/include/asm/arm64/efibind.h +++ b/xen/arch/arm/include/asm/arm64/efibind.h @@ -22,9 +22,9 @@ Revision History #pragma pack() #endif -#define EFIERR(a) (0x8000000000000000ULL | a) +#define EFIERR(a) (0x8000000000000000ULL | (a)) #define EFI_ERROR_MASK 0x8000000000000000ULL -#define EFIERR_OEM(a) (0xc000000000000000ULL | a) +#define EFIERR_OEM(a) (0xc000000000000000ULL | (a)) #define BAD_POINTER 0xFBFBFBFBFBFBFBFBULL #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h index e23cd16cb6a0..28bc18c24bb3 100644 --- a/xen/arch/x86/include/asm/x86_64/efibind.h +++ b/xen/arch/x86/include/asm/x86_64/efibind.h @@ -117,9 +117,9 @@ typedef uint64_t UINTN; #endif #endif -#define EFIERR(a) (0x8000000000000000 | a) +#define EFIERR(a) (0x8000000000000000 | (a)) #define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) +#define EFIERR_OEM(a) (0xc000000000000000 | (a)) #define BAD_POINTER 0xFBFBFBFBFBFBFBFB From patchwork Fri Mar 22 16:01:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600278 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 76BD7CD11BF for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696954.1088217 (Exim 4.92) (envelope-from ) id 1rnhLP-0001Gr-Ua; Fri, 22 Mar 2024 16:02:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696954.1088217; Fri, 22 Mar 2024 16:02: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 1rnhLP-0001G1-Oh; Fri, 22 Mar 2024 16:02:11 +0000 Received: by outflank-mailman (input) for mailman id 696954; Fri, 22 Mar 2024 16:02:11 +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 1rnhLP-0000WB-DB for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:11 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 89d1882e-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:09 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 0B02A4EE0C90; Fri, 22 Mar 2024 17:02:09 +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: 89d1882e-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap Subject: [XEN PATCH 04/11] xentrace: address violation of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:53 +0100 Message-Id: <06c112784c54fcd87792bb96515ecdf91b2109c3.1711118582.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/include/public/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index 62a179971d2a..3c9f9c3c18b2 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -67,7 +67,7 @@ #define TRC_SCHED_CLASS_EVT(_c, _e) \ ( ( TRC_SCHED_CLASS | \ ((TRC_SCHED_##_c << TRC_SCHED_ID_SHIFT) & TRC_SCHED_ID_MASK) ) + \ - (_e & TRC_SCHED_EVT_MASK) ) + ((_e) & TRC_SCHED_EVT_MASK) ) /* Trace classes for DOM0 operations */ #define TRC_DOM0_DOMOPS 0x00041000 /* Domains manipulations */ From patchwork Fri Mar 22 16:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600281 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 C5939C54E71 for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696955.1088231 (Exim 4.92) (envelope-from ) id 1rnhLR-0001h6-3p; Fri, 22 Mar 2024 16:02:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696955.1088231; Fri, 22 Mar 2024 16:02: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 1rnhLR-0001gF-0i; Fri, 22 Mar 2024 16:02:13 +0000 Received: by outflank-mailman (input) for mailman id 696955; Fri, 22 Mar 2024 16:02: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 1rnhLP-0000W5-V7 for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:11 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8a331fa7-e865-11ee-a1ee-f123f15fe8a2; Fri, 22 Mar 2024 17:02:10 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id A7A714EE0C91; Fri, 22 Mar 2024 17:02:09 +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: 8a331fa7-e865-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap Subject: [XEN PATCH 05/11] xen: address MISRA C Rule 20.7 violation in generated hypercall Date: Fri, 22 Mar 2024 17:01:54 +0100 Message-Id: <323c77d56f8dcbd6bf8f60c84aacff162265807e.1711118582.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 Reviewed-by: Jan Beulich --- xen/scripts/gen_hypercall.awk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/scripts/gen_hypercall.awk b/xen/scripts/gen_hypercall.awk index 9f7cfa298a6d..1a7e051fde10 100644 --- a/xen/scripts/gen_hypercall.awk +++ b/xen/scripts/gen_hypercall.awk @@ -277,7 +277,7 @@ END { if (call[i] == ca && call_prio[i] == p_list[pl]) { fnd++; if (fnd == 1) - printf(" if ( num == __HYPERVISOR_%s ) \\\n", fn[call_fn[i]]); + printf(" if ( (num) == __HYPERVISOR_%s ) \\\n", fn[call_fn[i]]); else printf(" else \\\n"); do_call(call_fn[i], call_p[i]); @@ -290,7 +290,7 @@ END { } else { for (i = 1; i <= nc; i++) if (call[i] == ca && call_prio[i] == p_list[pl]) { - printf("if ( likely(num == __HYPERVISOR_%s) ) \\\n", fn[call_fn[i]]); + printf("if ( likely((num) == __HYPERVISOR_%s) ) \\\n", fn[call_fn[i]]); do_call(call_fn[i], call_p[i]); } } From patchwork Fri Mar 22 16:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600284 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 0DDB4CD1280 for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696956.1088236 (Exim 4.92) (envelope-from ) id 1rnhLR-0001kL-GQ; Fri, 22 Mar 2024 16:02:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696956.1088236; Fri, 22 Mar 2024 16:02: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 1rnhLR-0001jR-9e; Fri, 22 Mar 2024 16:02:13 +0000 Received: by outflank-mailman (input) for mailman id 696956; Fri, 22 Mar 2024 16:02:12 +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 1rnhLQ-0000WB-DO for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:12 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8a922712-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:11 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 521E24EE0C92; Fri, 22 Mar 2024 17:02:10 +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: 8a922712-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org Subject: [XEN PATCH 06/11] xen/efi: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:55 +0100 Message-Id: <2d3842a990189c37fa12672994b779ad42975235.1711118582.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 --- xen/include/efi/efiapi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/include/efi/efiapi.h b/xen/include/efi/efiapi.h index a616d1238aa4..6d4d4e340d9e 100644 --- a/xen/include/efi/efiapi.h +++ b/xen/include/efi/efiapi.h @@ -63,7 +63,8 @@ EFI_STATUS OUT UINT32 *DescriptorVersion ); -#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) +#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) \ + ((UINT8 *)(Ptr) + (Size))) typedef From patchwork Fri Mar 22 16:01:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600280 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 E5239CD11DF for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696957.1088250 (Exim 4.92) (envelope-from ) id 1rnhLS-0002Az-PJ; Fri, 22 Mar 2024 16:02:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696957.1088250; Fri, 22 Mar 2024 16:02: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 1rnhLS-0002AK-Kv; Fri, 22 Mar 2024 16:02:14 +0000 Received: by outflank-mailman (input) for mailman id 696957; Fri, 22 Mar 2024 16:02: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 1rnhLR-0000W5-62 for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8af4cae7-e865-11ee-a1ee-f123f15fe8a2; Fri, 22 Mar 2024 17:02:11 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id EB4364EE074B; Fri, 22 Mar 2024 17:02:10 +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: 8af4cae7-e865-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap Subject: [XEN PATCH 07/11] xen/page_alloc: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:56 +0100 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/common/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 28c510d6669b..82dc55829f78 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -150,7 +150,7 @@ #include #else #define p2m_pod_offline_or_broken_hit(pg) 0 -#define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL) +#define p2m_pod_offline_or_broken_replace(pg) BUG_ON((pg) != NULL) #endif #ifndef PGC_static From patchwork Fri Mar 22 16:01:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600285 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 32E2BCD1282 for ; Fri, 22 Mar 2024 16:02:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696958.1088257 (Exim 4.92) (envelope-from ) id 1rnhLT-0002Hn-EJ; Fri, 22 Mar 2024 16:02:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696958.1088257; Fri, 22 Mar 2024 16:02: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 1rnhLT-0002Fd-4m; Fri, 22 Mar 2024 16:02:15 +0000 Received: by outflank-mailman (input) for mailman id 696958; Fri, 22 Mar 2024 16:02:14 +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 1rnhLS-0000W5-0a for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8b547583-e865-11ee-a1ee-f123f15fe8a2; Fri, 22 Mar 2024 17:02:12 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 961B34EE0C94; Fri, 22 Mar 2024 17:02:11 +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: 8b547583-e865-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org Subject: [XEN PATCH 08/11] x86/altcall: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:01:57 +0100 Message-Id: <653ead65966226f50b0e4ae0268912c9710f9dba.1711118582.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 --- xen/arch/x86/include/asm/alternative.h | 76 +++++++++++++------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h index 0d3697f1de49..a3b7cbab8740 100644 --- a/xen/arch/x86/include/asm/alternative.h +++ b/xen/arch/x86/include/asm/alternative.h @@ -243,28 +243,28 @@ extern void alternative_branches(void); #define alternative_vcall0(func) ({ \ ALT_CALL_NO_ARG1; \ - (void)sizeof(func()); \ + (void)sizeof((func)()); \ (void)alternative_callN(0, int, func); \ }) -#define alternative_call0(func) ({ \ - ALT_CALL_NO_ARG1; \ - alternative_callN(0, typeof(func()), func); \ +#define alternative_call0(func) ({ \ + ALT_CALL_NO_ARG1; \ + alternative_callN(0, typeof((func)()), func); \ }) #define alternative_vcall1(func, arg) ({ \ typeof(arg) v1_ = (arg); \ ALT_CALL_ARG(v1_, 1); \ ALT_CALL_NO_ARG2; \ - (void)sizeof(func(arg)); \ + (void)sizeof((func)(arg)); \ (void)alternative_callN(1, int, func); \ }) -#define alternative_call1(func, arg) ({ \ - typeof(arg) v1_ = (arg); \ - ALT_CALL_ARG(v1_, 1); \ - ALT_CALL_NO_ARG2; \ - alternative_callN(1, typeof(func(arg)), func); \ +#define alternative_call1(func, arg) ({ \ + typeof(arg) v1_ = (arg); \ + ALT_CALL_ARG(v1_, 1); \ + ALT_CALL_NO_ARG2; \ + alternative_callN(1, typeof((func)(arg)), func); \ }) #define alternative_vcall2(func, arg1, arg2) ({ \ @@ -273,17 +273,17 @@ extern void alternative_branches(void); ALT_CALL_ARG(v1_, 1); \ ALT_CALL_ARG(v2_, 2); \ ALT_CALL_NO_ARG3; \ - (void)sizeof(func(arg1, arg2)); \ + (void)sizeof((func)(arg1, arg2)); \ (void)alternative_callN(2, int, func); \ }) -#define alternative_call2(func, arg1, arg2) ({ \ - typeof(arg1) v1_ = (arg1); \ - typeof(arg2) v2_ = (arg2); \ - ALT_CALL_ARG(v1_, 1); \ - ALT_CALL_ARG(v2_, 2); \ - ALT_CALL_NO_ARG3; \ - alternative_callN(2, typeof(func(arg1, arg2)), func); \ +#define alternative_call2(func, arg1, arg2) ({ \ + typeof(arg1) v1_ = (arg1); \ + typeof(arg2) v2_ = (arg2); \ + ALT_CALL_ARG(v1_, 1); \ + ALT_CALL_ARG(v2_, 2); \ + ALT_CALL_NO_ARG3; \ + alternative_callN(2, typeof((func)(arg1, arg2)), func); \ }) #define alternative_vcall3(func, arg1, arg2, arg3) ({ \ @@ -294,20 +294,20 @@ extern void alternative_branches(void); ALT_CALL_ARG(v2_, 2); \ ALT_CALL_ARG(v3_, 3); \ ALT_CALL_NO_ARG4; \ - (void)sizeof(func(arg1, arg2, arg3)); \ + (void)sizeof((func)(arg1, arg2, arg3)); \ (void)alternative_callN(3, int, func); \ }) -#define alternative_call3(func, arg1, arg2, arg3) ({ \ - typeof(arg1) v1_ = (arg1); \ - typeof(arg2) v2_ = (arg2); \ - typeof(arg3) v3_ = (arg3); \ - ALT_CALL_ARG(v1_, 1); \ - ALT_CALL_ARG(v2_, 2); \ - ALT_CALL_ARG(v3_, 3); \ - ALT_CALL_NO_ARG4; \ - alternative_callN(3, typeof(func(arg1, arg2, arg3)), \ - func); \ +#define alternative_call3(func, arg1, arg2, arg3) ({ \ + typeof(arg1) v1_ = (arg1); \ + typeof(arg2) v2_ = (arg2); \ + typeof(arg3) v3_ = (arg3); \ + ALT_CALL_ARG(v1_, 1); \ + ALT_CALL_ARG(v2_, 2); \ + ALT_CALL_ARG(v3_, 3); \ + ALT_CALL_NO_ARG4; \ + alternative_callN(3, typeof((func)(arg1, arg2, arg3)), \ + func); \ }) #define alternative_vcall4(func, arg1, arg2, arg3, arg4) ({ \ @@ -320,7 +320,7 @@ extern void alternative_branches(void); ALT_CALL_ARG(v3_, 3); \ ALT_CALL_ARG(v4_, 4); \ ALT_CALL_NO_ARG5; \ - (void)sizeof(func(arg1, arg2, arg3, arg4)); \ + (void)sizeof((func)(arg1, arg2, arg3, arg4)); \ (void)alternative_callN(4, int, func); \ }) @@ -334,8 +334,8 @@ extern void alternative_branches(void); ALT_CALL_ARG(v3_, 3); \ ALT_CALL_ARG(v4_, 4); \ ALT_CALL_NO_ARG5; \ - alternative_callN(4, typeof(func(arg1, arg2, \ - arg3, arg4)), \ + alternative_callN(4, typeof((func)(arg1, arg2, \ + arg3, arg4)), \ func); \ }) @@ -351,7 +351,7 @@ extern void alternative_branches(void); ALT_CALL_ARG(v4_, 4); \ ALT_CALL_ARG(v5_, 5); \ ALT_CALL_NO_ARG6; \ - (void)sizeof(func(arg1, arg2, arg3, arg4, arg5)); \ + (void)sizeof((func)(arg1, arg2, arg3, arg4, arg5)); \ (void)alternative_callN(5, int, func); \ }) @@ -367,8 +367,8 @@ extern void alternative_branches(void); ALT_CALL_ARG(v4_, 4); \ ALT_CALL_ARG(v5_, 5); \ ALT_CALL_NO_ARG6; \ - alternative_callN(5, typeof(func(arg1, arg2, arg3, \ - arg4, arg5)), \ + alternative_callN(5, typeof((func)(arg1, arg2, arg3, \ + arg4, arg5)), \ func); \ }) @@ -385,7 +385,7 @@ extern void alternative_branches(void); ALT_CALL_ARG(v4_, 4); \ ALT_CALL_ARG(v5_, 5); \ ALT_CALL_ARG(v6_, 6); \ - (void)sizeof(func(arg1, arg2, arg3, arg4, arg5, arg6)); \ + (void)sizeof((func)(arg1, arg2, arg3, arg4, arg5, arg6)); \ (void)alternative_callN(6, int, func); \ }) @@ -402,8 +402,8 @@ extern void alternative_branches(void); ALT_CALL_ARG(v4_, 4); \ ALT_CALL_ARG(v5_, 5); \ ALT_CALL_ARG(v6_, 6); \ - alternative_callN(6, typeof(func(arg1, arg2, arg3, \ - arg4, arg5, arg6)), \ + alternative_callN(6, typeof((func)(arg1, arg2, arg3, \ + arg4, arg5, arg6)), \ func); \ }) From patchwork Fri Mar 22 16:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600286 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 67F69CD1283 for ; Fri, 22 Mar 2024 16:02:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696960.1088275 (Exim 4.92) (envelope-from ) id 1rnhLV-0002nd-AD; Fri, 22 Mar 2024 16:02:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696960.1088275; Fri, 22 Mar 2024 16:02:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rnhLV-0002l1-0m; Fri, 22 Mar 2024 16:02:17 +0000 Received: by outflank-mailman (input) for mailman id 696960; Fri, 22 Mar 2024 16:02:15 +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 1rnhLS-0000W5-W0 for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8bb2b0a1-e865-11ee-a1ee-f123f15fe8a2; Fri, 22 Mar 2024 17:02:12 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 38C994EE0C95; Fri, 22 Mar 2024 17:02:12 +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: 8bb2b0a1-e865-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org Subject: [XEN PATCH 09/11] x86/msi: address violation of MISRA C Rule 20.7 and coding style Date: Fri, 22 Mar 2024 17:01:58 +0100 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. While at it, the style of these macros has been somewhat uniformed. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/include/asm/msi.h | 47 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h index 997ccb87be0c..e24d46d95a02 100644 --- a/xen/arch/x86/include/asm/msi.h +++ b/xen/arch/x86/include/asm/msi.h @@ -147,33 +147,34 @@ int msi_free_irq(struct msi_desc *entry); */ #define NR_HP_RESERVED_VECTORS 20 -#define msi_control_reg(base) (base + PCI_MSI_FLAGS) -#define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) -#define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) -#define msi_data_reg(base, is64bit) \ - ( (is64bit == 1) ? base+PCI_MSI_DATA_64 : base+PCI_MSI_DATA_32 ) -#define msi_mask_bits_reg(base, is64bit) \ - ( (is64bit == 1) ? base+PCI_MSI_MASK_BIT : base+PCI_MSI_MASK_BIT-4) +#define msi_control_reg(base) ((base) + PCI_MSI_FLAGS) +#define msi_lower_address_reg(base) ((base) + PCI_MSI_ADDRESS_LO) +#define msi_upper_address_reg(base) ((base) + PCI_MSI_ADDRESS_HI) +#define msi_data_reg(base, is64bit) \ + (((is64bit) == 1) ? (base) + PCI_MSI_DATA_64 : (base) + PCI_MSI_DATA_32) +#define msi_mask_bits_reg(base, is64bit) \ + (((is64bit) == 1) ? (base) + PCI_MSI_MASK_BIT \ + : (base) + PCI_MSI_MASK_BIT - 4) #define msi_pending_bits_reg(base, is64bit) \ - ((base) + PCI_MSI_MASK_BIT + ((is64bit) ? 4 : 0)) -#define msi_disable(control) control &= ~PCI_MSI_FLAGS_ENABLE + ((base) + PCI_MSI_MASK_BIT + ((is64bit) ? 4 : 0)) +#define msi_disable(control) (control) &= ~PCI_MSI_FLAGS_ENABLE #define multi_msi_capable(control) \ - (1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1)) + (1 << (((control) & PCI_MSI_FLAGS_QMASK) >> 1)) #define multi_msi_enable(control, num) \ - control |= (((fls(num) - 1) << 4) & PCI_MSI_FLAGS_QSIZE); -#define is_64bit_address(control) (!!(control & PCI_MSI_FLAGS_64BIT)) -#define is_mask_bit_support(control) (!!(control & PCI_MSI_FLAGS_MASKBIT)) + (control) |= (((fls(num) - 1) << 4) & PCI_MSI_FLAGS_QSIZE); +#define is_64bit_address(control) (!!((control) & PCI_MSI_FLAGS_64BIT)) +#define is_mask_bit_support(control) (!!((control) & PCI_MSI_FLAGS_MASKBIT)) #define msi_enable(control, num) multi_msi_enable(control, num); \ - control |= PCI_MSI_FLAGS_ENABLE - -#define msix_control_reg(base) (base + PCI_MSIX_FLAGS) -#define msix_table_offset_reg(base) (base + PCI_MSIX_TABLE) -#define msix_pba_offset_reg(base) (base + PCI_MSIX_PBA) -#define msix_enable(control) control |= PCI_MSIX_FLAGS_ENABLE -#define msix_disable(control) control &= ~PCI_MSIX_FLAGS_ENABLE -#define msix_table_size(control) ((control & PCI_MSIX_FLAGS_QSIZE)+1) -#define msix_unmask(address) (address & ~PCI_MSIX_VECTOR_BITMASK) -#define msix_mask(address) (address | PCI_MSIX_VECTOR_BITMASK) + (control) |= PCI_MSI_FLAGS_ENABLE + +#define msix_control_reg(base) ((base) + PCI_MSIX_FLAGS) +#define msix_table_offset_reg(base) ((base) + PCI_MSIX_TABLE) +#define msix_pba_offset_reg(base) ((base) + PCI_MSIX_PBA) +#define msix_enable(control) (control) |= PCI_MSIX_FLAGS_ENABLE +#define msix_disable(control) (control) &= ~PCI_MSIX_FLAGS_ENABLE +#define msix_table_size(control) (((control) & PCI_MSIX_FLAGS_QSIZE) + 1) +#define msix_unmask(address) ((address) & ~PCI_MSIX_VECTOR_BITMASK) +#define msix_mask(address) ((address) | PCI_MSIX_VECTOR_BITMASK) /* * MSI Defined Data Structures From patchwork Fri Mar 22 16:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600287 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 C18C2CD11BF for ; Fri, 22 Mar 2024 16:02:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696961.1088284 (Exim 4.92) (envelope-from ) id 1rnhLW-0002vv-2m; Fri, 22 Mar 2024 16:02:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696961.1088284; Fri, 22 Mar 2024 16:02:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rnhLV-0002uW-Jt; Fri, 22 Mar 2024 16:02:17 +0000 Received: by outflank-mailman (input) for mailman id 696961; Fri, 22 Mar 2024 16:02:16 +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 1rnhLT-0000W5-W7 for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:15 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8c10b010-e865-11ee-a1ee-f123f15fe8a2; Fri, 22 Mar 2024 17:02:13 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id D0A7D4EE0C93; Fri, 22 Mar 2024 17:02:12 +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: 8c10b010-e865-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org Subject: [XEN PATCH 10/11] x86/hvm: address violations of Rule 20.7 Date: Fri, 22 Mar 2024 17:01:59 +0100 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/hvm/hvm.c | 6 +++--- xen/arch/x86/include/asm/hvm/save.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index c75959588c0e..0ce45b177cf4 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1066,9 +1066,9 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) /* Older Xen versions used to save the segment arbytes directly * from the VMCS on Intel hosts. Detect this and rearrange them * into the struct segment_register format. */ -#define UNFOLD_ARBYTES(_r) \ - if ( (_r & 0xf000) && !(_r & 0x0f00) ) \ - _r = ((_r & 0xff) | ((_r >> 4) & 0xf00)) +#define UNFOLD_ARBYTES(_r) \ + if ( ((_r) & 0xf000) && !((_r) & 0x0f00) ) \ + (_r) = (((_r) & 0xff) | (((_r) >> 4) & 0xf00)) UNFOLD_ARBYTES(ctxt.cs_arbytes); UNFOLD_ARBYTES(ctxt.ds_arbytes); UNFOLD_ARBYTES(ctxt.es_arbytes); diff --git a/xen/arch/x86/include/asm/hvm/save.h b/xen/arch/x86/include/asm/hvm/save.h index 04a47ffcc40a..2d4b591aa3e2 100644 --- a/xen/arch/x86/include/asm/hvm/save.h +++ b/xen/arch/x86/include/asm/hvm/save.h @@ -128,9 +128,9 @@ static int __init cf_check __hvm_register_##_x##_save_and_restore(void) \ { \ hvm_register_savevm(HVM_SAVE_CODE(_x), \ #_x, \ - &_save, \ + &(_save), \ check, \ - &_load, \ + &(_load), \ (_num) * (HVM_SAVE_LENGTH(_x) \ + sizeof (struct hvm_save_descriptor)), \ _k); \ From patchwork Fri Mar 22 16:02:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13600283 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 EFA80CD1281 for ; Fri, 22 Mar 2024 16:02:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.696959.1088270 (Exim 4.92) (envelope-from ) id 1rnhLU-0002h2-Qz; Fri, 22 Mar 2024 16:02:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 696959.1088270; Fri, 22 Mar 2024 16:02:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rnhLU-0002gb-MG; Fri, 22 Mar 2024 16:02:16 +0000 Received: by outflank-mailman (input) for mailman id 696959; Fri, 22 Mar 2024 16:02: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 1rnhLS-0000WB-OF for xen-devel@lists.xenproject.org; Fri, 22 Mar 2024 16:02:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8c76c732-e865-11ee-afe0-a90da7624cb6; Fri, 22 Mar 2024 17:02:14 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 7267D4EE0C97; Fri, 22 Mar 2024 17:02:13 +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: 8c76c732-e865-11ee-afe0-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, 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, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org Subject: [XEN PATCH 11/11] x86/public: hvm: address violations of MISRA C Rule 20.7 Date: Fri, 22 Mar 2024 17:02:00 +0100 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/public/arch-x86/xen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index c0f4551247f4..a9a87d9b50de 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -36,7 +36,7 @@ #define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name #define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name) #define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name) -#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0) +#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = (val); } while (0) #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) #if defined(__i386__)