@@ -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)))
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@arm.com> --- xen/include/xen/xmalloc.h | 6 ++++++ 1 file changed, 6 insertions(+)