|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] misra: add deviation of Rule 17.7
MISRA C Rule 17.7 states: "The value returned by a function having
non-void return type shall be used."
Deviate functions like 'memcpy()', 'memset()', 'memmove()', 'snprintf()',
'strlcpy()', 'strlcat()', as they return a value purely for convenience,
their primary functionality (e.g., memory or string operations) remains
unaffected, and their return values are generally non-critical and seldom
relied upon. Update 'deviations.rst' file accordingly.
No functional changes.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
docs/misra/deviations.rst | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 7f3fd35a33..23f62ef646 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -575,6 +575,12 @@ safe."
-config=MC3A2.R17.7,calls+={safe, "any()",
"decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
-doc_end
+-doc_begin="It is safe to deviate functions like 'memcpy()', 'memset()',
'memmove()', 'snprintf()', 'strlcpy()', 'strlcat()',
+as they return a value purely for convenience, their primary functionality
(e.g., memory manipulation or string operations)
+remains unaffected, and their return values are generally non-critical and
seldom relied upon."
+-config=MC3A2.R17.7,calls+={safe, "any()",
"decl(name(memcpy||memset||memmove||snprintf||strlcpy||strlcat))"}
+-doc_end
+
#
# Series 18.
#
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 2119066531..ec98366aa5 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -576,6 +576,14 @@ Deviations related to MISRA C:2012 Rules:
- __builtin_memset()
- cpumask_check()
+ * - R17.7
+ - It is safe to deviate functions like 'memcpy()', 'memset()',
'memmove()',
+ 'snprintf()', 'strlcpy()', 'strlcat()', as they return a value purely
for
+ convenience, their primary functionality (e.g., memory manipulation or
+ string operations) remains unaffected, and their return values are
+ generally non-critical and seldom relied upon.
+ - Tagged as `safe` for ECLAIR.
+
* - R18.2
- Subtractions between pointers where at least one of the operand is a
pointer to a symbol defined by the linker are safe.
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |