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

[xen master] xen/elf: fix MISRA C 2012 Rule 20.7 violations



commit c5659ef2dab3b4f538615e46a4990eea3101917c
Author:     Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
AuthorDate: Mon Aug 22 12:10:28 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 22 12:10:28 2022 +0200

    xen/elf: fix MISRA C 2012 Rule 20.7 violations
    
    In macros ELF32_ST_TYPE() and ELF64_ST_TYPE(), add parentheses around the
    macro parameter to prevent against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/include/xen/elfstructs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 616ebf9269..06e6f87c3d 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -305,11 +305,11 @@ typedef struct {
 
 /* Extract symbol info - st_info */
 #define ELF32_ST_BIND(x)       ((x) >> 4)
-#define ELF32_ST_TYPE(x)       (((unsigned int) x) & 0xf)
+#define ELF32_ST_TYPE(x)       (((unsigned int)(x)) & 0xf)
 #define ELF32_ST_INFO(b,t)     (((b) << 4) + ((t) & 0xf))
 
 #define ELF64_ST_BIND(x)       ((x) >> 4)
-#define ELF64_ST_TYPE(x)       (((unsigned int) x) & 0xf)
+#define ELF64_ST_TYPE(x)       (((unsigned int)(x)) & 0xf)
 #define ELF64_ST_INFO(b,t)     (((b) << 4) + ((t) & 0xf))
 
 /* Symbol Binding - ELF32_ST_BIND - st_info */
--
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®.