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

[RFC PATCH 11/18] xen: cppcheck: misra rule 20.7 deviation on xmalloc.h



Cppcheck has found violations of rule 20.7 for the macros xmalloc,
xzalloc, xmalloc_array, xzalloc_array, xzalloc_flex_struct and
xmalloc_flex_struct.
In all the cases the macro parameters are never used as an expression,
so it is safe to suppress the findings.

Eclair and coverity does not report these findings.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 xen/include/xen/xmalloc.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h
index 16979a117c6a..5bf440502c20 100644
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -10,7 +10,9 @@
  */
 
 /* Allocate space for typed object. */
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))
 
 /*
@@ -30,15 +32,19 @@
 })
 
 /* Allocate space for array of typed objects. */
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xmalloc_array(_type, _num) \
     ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xzalloc_array(_type, _num) \
     ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
 
 /* Allocate space for a structure with a flexible array of typed objects. */
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xzalloc_flex_struct(type, field, nr) \
     ((type *)_xzalloc(offsetof(type, field[nr]), __alignof__(type)))
 
+/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */
 #define xmalloc_flex_struct(type, field, nr) \
     ((type *)_xmalloc(offsetof(type, field[nr]), __alignof__(type)))
 
-- 
2.17.1




 


Rackspace

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