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

[RFC PATCH 05/18] arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h



Cppcheck has found a violation of rule 20.7 for the macro memset
about missing parenthesis for the "n" argument, while the parenthesis
are not mandatory because the argument is never used in an
expression, adding them will not harm code and readability, so fix
the finding adding parenthesis for the argument.

Eclair and coverity does not report this finding.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 xen/arch/arm/include/asm/string.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/string.h 
b/xen/arch/arm/include/asm/string.h
index b485e4904419..f1c87d215b0b 100644
--- a/xen/arch/arm/include/asm/string.h
+++ b/xen/arch/arm/include/asm/string.h
@@ -30,7 +30,7 @@ void __memzero(void *ptr, size_t n);
 
 #define memset(p, v, n)                                                 \
         ({                                                              \
-                void *__p = (p); size_t __n = n;                        \
+                void *__p = (p); size_t __n = (n);                      \
                 if ((__n) != 0) {                                       \
                         if (__builtin_constant_p((v)) && (v) == 0)      \
                                 __memzero((__p),(__n));                 \
-- 
2.17.1




 


Rackspace

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