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

[RFC PATCH 16/18] public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h



Cppcheck has found violations of rule 20.7 for the macros
___DEFINE_XEN_GUEST_HANDLE and set_xen_guest_handle_raw.
For the first one, the macro parameters are never used as an
expression, so it is safe to suppress the finding.
For the second one, while the argument "val" is never used
in an expression, it doesn't harm the code or the readability,
so add them.

Eclair and coverity does not report these findings.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 xen/include/public/arch-x86/xen.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/include/public/arch-x86/xen.h 
b/xen/include/public/arch-x86/xen.h
index c0f4551247f4..04f5bc899ae3 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -14,6 +14,7 @@
 
 /* Structural guest handles introduced in 0x00030201. */
 #if __XEN_INTERFACE_VERSION__ >= 0x00030201
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
     typedef struct { type *p; } __guest_handle_ ## name
 #else
@@ -36,7 +37,7 @@
 #define __XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
 #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
 #define XEN_GUEST_HANDLE_PARAM(name)    XEN_GUEST_HANDLE(name)
-#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
+#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = (val); } while (0)
 #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
 
 #if defined(__i386__)
-- 
2.17.1




 


Rackspace

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