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

[xen master] xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts



commit 4c0c96167476a808c2c81a2821722981677062db
Author:     Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Fri Jun 12 09:26:21 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jun 12 09:26:21 2026 +0200

    xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts
    
    Convert 'free' macro in 'decompress.h' from object-like to function-like
    form.
    
    The object-like macro '#define free xfree' performs unconditional text
    replacement, causing conflicts with identifiers named 'free', such as
    struct fields in 'page_info' unions defined in 
'xen/arch/arm/include/asm/mm.h'.
    Function-like macros only match when followed by parentheses, allowing
    'free' to be used both as a macro and as a struct field without conflicts.
    
    Applying function-like form to 'malloc', 'large_malloc' and 'large_free'
    ensures consistent macro style.
    
    Additionally moved 'large_{malloc,free}' past the #endif to reduce
    redundancy.
    
    While function-like macros prevent uses where the underlying function
    identifier is needed directly, such as taking a function pointer, no
    such uses exist in the current Xen codebase.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/common/decompress.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 034c833665..b347d91980 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -9,11 +9,8 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 
-#define malloc xmalloc_bytes
-#define free xfree
-
-#define large_malloc xmalloc_bytes
-#define large_free xfree
+#define malloc(s) xmalloc_bytes(s)
+#define free(p) xfree(p)
 
 #else
 
@@ -21,9 +18,9 @@
 #define __init
 #define __initdata
 
-#define large_malloc malloc
-#define large_free free
-
 #endif
 
+#define large_malloc(s) malloc(s)
+#define large_free(p) free(p)
+
 #endif /* DECOMPRESS_H */
--
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®.