From da88f434bc9f9fbc943c78f8b86ed0c94b148ee7 Mon Sep 17 00:00:00 2001 From: Nicola Vetrini Date: Wed, 3 Apr 2024 09:36:30 +0200 Subject: [PATCH] xen/mm: address violations of MISRA C Rule 20.7 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/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 3e84960a36..7561297a75 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -415,15 +415,15 @@ page_list_splice(struct page_list_head *list, struct page_list_head *head) } #define page_list_for_each(pos, head) \ - for ( pos = (head)->next; pos; pos = page_list_next(pos, head) ) + for ( (pos) = (head)->next; (pos); (pos) = page_list_next(pos, head) ) #define page_list_for_each_safe(pos, tmp, head) \ - for ( pos = (head)->next; \ - pos ? (tmp = page_list_next(pos, head), 1) : 0; \ - pos = tmp ) + for ( (pos) = (head)->next; \ + (pos) ? ((tmp) = page_list_next(pos, head), 1) : 0; \ + (pos) = (tmp) ) #define page_list_for_each_safe_reverse(pos, tmp, head) \ - for ( pos = (head)->tail; \ - pos ? (tmp = page_list_prev(pos, head), 1) : 0; \ - pos = tmp ) + for ( (pos) = (head)->tail; \ + (pos) ? ((tmp) = page_list_prev(pos, head), 1) : 0; \ + (pos) = (tmp) ) #else # define page_list_head list_head # define PAGE_LIST_HEAD_INIT LIST_HEAD_INIT -- 2.39.5