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

[PATCH] misra: add deviation of Rule 17.7


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Mon, 25 Aug 2025 09:05:48 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9p5vkLzBi6WoxV7ONWFQXqNZkOMCXQPRPXNJETtU7UQ=; b=zCe3m/sJGd9bFQeJRcwQfROZTknceQ5NvOQ/5O37DVp/y5er87UhDQBnFzMlIKteVbC7q02J7vQoh7QIi1prQIFG3z2cjwcWfn3SLLS/p4oKdCJmA6ChL/QeqiASNzye9sRduhU+a16/JNtM2ig7XJ6PibrR4D5L0PA4tTxZK0m1Rpllw8q1qlexviSM/KmsgCWIM432rAY5y76l1EbRBT7CTLCUOR/ABCQcWQjjpCFO4r7q7/ykPItP6ZAA3+94H1k6v7y80mI+XVcgfrFjt4QTjccLaZPHcuz+89ovCDRK533i/Xv0jeuF7e+1LGVrl7eWEU0DEQEcen3U/JzDKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vm2klFRuAyEUMY1K8x+d21jqEF9cUyjYjpd95eiD3Sef/JG7TioliS2VT8XA1Q6DehBn4oU+z/9dCYpN2HN9Y1/iLbP3ceO0cZH52RaQMNu8TO+OfcTXZvdbXLDeUbwqbXA61Ug/HEw2zV2mNR/p639+ZpBHqcsF/Atgd6NW9S2NRhIrZHSP/BUFNDU702N2HnUipWdc3ZfmLHfW9yoo1vRxZJ01ziRtxBoYyqOYwYG0aTZjJaVovATev6JyLLDI1vTceFnmZKVjiRbtUgViq852BpJgjd0+WKnDVMXul23ZqP1PvAGfRj2cPGmBV5quypGQ6sn6PdGDgxKDqN9iPA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 25 Aug 2025 09:06:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcFZ9zsboRH18vd0iLUvum4pfwBQ==
  • Thread-topic: [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



 


Rackspace

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