MISRA C Rule 17.7 states: "The value returned by a function having
non-void return type shall be used."

The functions 'memcpy()', 'memset()', and 'memmove()' return values
primarily for convenience. The core functionality of these functions
(memory manipulation) remains unaffected, and their return values
are generally non-critical and seldom relied upon. Therefore,
violations of this rule due to these functions are deemed safe.

Update 'deviations.rst' file accordingly. No functional changes.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopch...@epam.com>
Reviewed-by: Nicola Vetrini <nicola.vetr...@bugseng.com>
---
Changes in v3:
- changed the last sentence in wording
- added Nicola's Reviewed-by tag

Link to v2:
https://patchew.org/Xen/812b78119cee801662a31d39b556cb453aa69508.1756192362.git.dmytro._5fprokopch...@epam.com/
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 7 +++++++
 docs/misra/deviations.rst                        | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 7f3fd35a33..f410eafad6 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -575,6 +575,13 @@ safe."
 -config=MC3A2.R17.7,calls+={safe, "any()", 
"decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end
 
+-doc_begin="The functions 'memcpy()', 'memset()', and 'memmove()' return 
values primarily for convenience.
+The core functionality of these functions (memory manipulation) remains 
unaffected, and their return values
+are generally non-critical and seldom relied upon. Therefore, violations of 
this rule due to these functions
+are deemed safe."
+-config=MC3A2.R17.7,calls+={safe, "any()", 
"decl(name(memcpy||memset||memmove))"}
+-doc_end
+
 #
 # Series 18.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 2119066531..8e086d989f 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
+     - The functions 'memcpy()', 'memset()', and 'memmove()' return values
+       primarily for convenience. The core functionality of these functions
+       (memory manipulation) remains unaffected, and their return values are
+       generally non-critical and seldom relied upon. Therefore, violations
+       of this rule due to these functions are deemed safe.
+     - 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

Reply via email to