[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/mm: address violations of MISRA C Rule 20.7



commit da88f434bc9f9fbc943c78f8b86ed0c94b148ee7
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Wed Apr 3 09:36:30 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 3 09:36:30 2024 +0200

    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 <nicola.vetrini@xxxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.