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

[PATCH v2 1/3] misra: deviate MISRA C Rule 5.5 for 'hypfs_alloc_dyndata()'


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Sun, 12 Jul 2026 14:04:44 +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=Aikdj9hX9Ez/J0T4upRKLp62iT8tY2+jkV0GfNhHj3w=; b=PyPyy/DD7FaayYdCDyyjnCdItWAVNM/LCyyr2WM5VEQBbNNF6hK/D9gIyqqEpeX+7XmumtDPph9TcFC2aaUH37reVVpbgLbRESUWi24bLGgUVV4AEaGzuC/pHYrhGw1jNVS3m+BpNOClqCdSVo9UAB+j3GV+Zb9rS0fzpFbRTb0xoqYf8w5OaEu7T5AFRUW49q3OV791BKwB2naMal5b/jsYx76wbfo2ao0sJ/zaO4Dvlb4MUdEJYNkMQo1EVI4IyV4U/t/T/2jFnuUfF8DALEwJgSJQM0e07CMT14f2xcj/awFmHdtZDGp21yo0Fu/Rdf62WWNWIkZr7RR+7PvZSA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wZqb2QjNkYYs8YImGebgSvADWlIoN+xi/REvKo9fwqPa0blpX6wGjq4VJ7jc91VzJraANOBrtwrrwrjAMrCb4LH4nC1R/eqyc8rNJe0X/8flUPC5T2kpEMWxCBbZ3/th0V80VAbrzFUkP1rnHe/Rna6cj2iSFy5uruTSk6605lxDjV/Sxbh7tHWTJczTFlvCV7D9fEcLfkQUF8QXukTbo5Fu1aH+06o6+7DHhHqvl/Bnn8gnT3EQYLvn1Feju2376UMXD7DlJzEkXePxBgpEs4ddz9iIz9wpaIQRWb+T74K8sSRpeMMogTNc9Um3n+YQydiXVgkYV391P2EtS4H36w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • 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: Sun, 12 Jul 2026 14:05:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdEgdk86c5ivEPyUWTFvlIOTPRVw==
  • Thread-topic: [PATCH v2 1/3] misra: deviate MISRA C Rule 5.5 for 'hypfs_alloc_dyndata()'

MISRA C Rule 5.5 states: "Identifiers shall be distinct from macro
names".

Update ECLAIR configuration to deviate identifier and macro name
clashes by specifying the macros that should be ignored.
This includes 'hypfs_alloc_dyndata()', where the real function takes
an allocation size and the same-named macro is a typed convenience
wrapper that expands calls using sizeof(type).

Update deviations.rst and rules.rst accordingly.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 9 +++++++++
 docs/misra/rules.rst                             | 4 ++++
 3 files changed, 17 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 7d4b6f2948..7e743f7c5e 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -132,6 +132,10 @@ These macros address differences in argument count during 
compile-time, effectiv
 
-config=MC3A2.R5.5,ignored_macros+="name(update_gnttab_par||parse_gnttab_limit)&&loc(file(^xen/common/grant_table\\.c$))"
 -doc_end
 
+-doc_begin="Clash between 'hypfs_alloc_dyndata()' function and macro name in 
'xen/include/xen/hypfs.h' is deliberate."
+-config=MC3A2.R5.5,ignored_macros+="name(hypfs_alloc_dyndata)&&loc(file(^xen/include/xen/hypfs\\.h$))"
+-doc_end
+
 -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
 depending on the guest."
 -config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index b048309596..ab80f01195 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -176,6 +176,15 @@ Deviations related to MISRA C:2012 Rules:
        unused 2nd and 3rd parameters to avoid warnings or errors related to 
them.
      - ECLAIR has been configured to ignore these macros.
 
+   * - R5.5
+     - Clash between the 'hypfs_alloc_dyndata()' function and macro name is
+       deliberate. The function is the allocator taking a size in bytes, while
+       the macro is a typed convenience wrapper used by dynamic hypfs nodes to
+       allocate per-request traversal data with the correct size and return 
type.
+       The implementation explicitly undefines the macro before defining the 
real
+       function, so the name clash is controlled.
+     - ECLAIR has been configured to ignore this macro.
+
    * - R5.6
      - The type ret_t is deliberately defined multiple times depending on the
        type of guest to service.
diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index b3e929307d..4f7b7fc848 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -222,6 +222,10 @@ maintainers if you want to suggest a change.
        Clashes between grant table functions and macro names are allowed
        because they are used for discarding unused parameters.
 
+       Clash between hypfs_alloc_dyndata() function and macro names is allowed
+       because the macro is a typed convenience wrapper around the size-based
+       allocation function.
+
    * - `Rule 5.6 
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_06.c>`_
      - Required
      - A typedef name shall be a unique identifier
-- 
2.43.0



 


Rackspace

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