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

[PATCH v2] misra: add deviation of Rule 17.7


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 26 Aug 2025 07:36:20 +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=eG7VgBSoakS2HenjB8k0q9gUCulKgRfpj9rxtOR3G8o=; b=da5wHOjaVmWRgsT5QIt2mPL/ffMlzH7FiEeSbbGhH2Y1EF6+f3Uzjicq5V3f9N8w3H7pwE88d1HERIS+MMMykczsZwTBZXVZbC6xXqYYloTMs8yDe+n2JPtdL9eTmXPHBMDUdz8iQitLoVFftVy2E6tKdXsDokYrY2Sew66/aXw0CeexC0V+x5/92ENjj3P6q0zNaOtZQ1iGbb2XZSJo+Zcot6CpT3VO0wgEVgzkSxk/K9YKNwb9VQoCG0d6wigMKEsbVxnJQw96Q3dc3wfL7ufN6Al5g3WxXMqtoJvE96GMhN29EZKS9lTN2x8C1zGHrWL8RktNwpEYVLEg/JtgVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n+ThdjTNLVQQydP0GSVBN6Lzs9EGMHj6GDEC9JIxEJE1YEBine8RIG6s0otZMTRA370effuf4GQ90U60ZjEtAhdkfinOTAOATI8Ug+AJFQeJTC0W5Za89XOdgZLXI73yimTziVEl/6cJBwXxQMXvtqut+Nu5kIGUWRkk5h8KyQZ1YHoYJpQGLI5mFwDzyZOXQ6B241Z4a4zap1YNzVUDZ+YtyvbL2QJru1dgDBbO3hAQVEhMqFKBy0fscwoQPeTo/K2QEnX0SkT6BzJyB2BG9XjnGgZo2vYBCgWRZRe82dDTajhPAmpv+n5ANPcuLnYZzNlfDIruaq5Igw0xF/4n/g==
  • 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: Tue, 26 Aug 2025 07:36:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcFlwdO9JZfbniJ0qkcPaDWppdxw==
  • Thread-topic: [PATCH v2] 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()', as they
return a value purely for convenience, their primary functionality
(memory manipulation) 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>
---
Changes in v2:
- removed snprintf(), strlcpy(), strlcat() from the patch scope

Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2003537146

Link to v1:
https://patchew.org/Xen/ad15582787e675fadf92502f85041c3232749a99.1756112701.git.dmytro._5Fprokopchuk1@xxxxxxxx/
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 5 +++++
 docs/misra/deviations.rst                        | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 7f3fd35a33..8335af1bce 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -575,6 +575,11 @@ 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()', as they return a value purely for convenience,
+their primary functionality (memory manipulation) 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))"}
+-doc_end
+
 #
 # Series 18.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 2119066531..5ee97f41e8 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -576,6 +576,13 @@ Deviations related to MISRA C:2012 Rules:
          - __builtin_memset()
          - cpumask_check()
 
+   * - R17.7
+     - It is safe to deviate functions like 'memcpy()', 'memset()', 
'memmove()',
+       as they return a value purely for convenience, their primary 
functionality
+       (memory manipulation) 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®.