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

[PATCH v1 1/2] xen/page_alloc: address violation of Rule 14.3


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: <victorm.lira@xxxxxxx>
  • Date: Fri, 25 Apr 2025 17:00:09 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=4TndO7wIwFF/vKgNqTIQTB7DHEhbWcGym70m5yHQmNg=; b=nH8brZMWPKvBj37cgii4wR6VjBPvt0AQRggvj+ZqjEEnXeu6SIRQ063qOwRjeM9eCxBhdflotF3Oh4rYxm4M16WjPu5Pr0CMAjeK9GoPCYrZiM6XYAUn8NwDVFQ5bAu7DgxtQ90yD5GyAXw+lp4NamntplWACQtoDQD9PVY9uYjQKorhstXs6yS9ii3pkE/YqbIlFrVXFMEiW2A8I93gXGi6sOeDHZn7OElsHl8I+BJ5fgv0CXwg3tX/Mke3hZiXqWlTs0KZ+7+qLUoaRKnddj5JrQLzdr30B2dm2xbi3bZYJ+yHt6Iy0qoSdff8pGO0R/zVKvJP4rpN2AyLvry/vg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y9Vjj4pRLr4AbkZ+vBgXHVROVamfD6C9k14D+PStgPPuVU5aYY7OnIs+n7zuFqchv2hg6rtJPagaEeoeTzhBwnGui609xiVOXvwYGMUGuGAN8yNwVXNcpzGyU7V4SKv93Z4ONdg/qUmDpJmytpB9cn8hcSesSny/u4Yw8CAmYFPMvZnN/0m+MJbAME3T13TMykVntMGicLlKva/ymfn4evJ7GYpRY830LhguBrkswoTs5USzqu1bN9qpalq672XQBAp5iodIkUDPI+xSiau4k66m9hKh2Ffa328kG2KV/CL46MTY1T+5+j8D93zpSc6JpkOazBQKWWvq3Bp9Ka/ZTg==
  • Cc: Federico Serafini <federico.serafini@xxxxxxxxxxx>, Victor Lira <victorm.lira@xxxxxxx>, 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>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Sat, 26 Apr 2025 00:00:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Federico Serafini <federico.serafini@xxxxxxxxxxx>

MISRA C Rule 14.3 states that "Controlling expressions shall not be
invariant".

Add a SAF comment to deviate the rule for build configurations without
CONFIG_LLC_COLORING enabled.

Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Cc: Michal Orzel <michal.orzel@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Julien Grall <julien@xxxxxxx>
Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Cc: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---

 docs/misra/safe.json    | 8 ++++++++
 xen/common/page_alloc.c | 1 +
 2 files changed, 9 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index e3489dba8e..9438815d19 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -116,6 +116,14 @@
         },
         {
             "id": "SAF-14-safe",
+            "analyser": {
+                  "eclair": "MC3A2.R14.3"
+            },
+            "name": "Rule 14.3: loop controlling expression is invariant due 
to the build configuration",
+            "text": "The controlling expression of a loop can be invariant in 
a specific build configuration."
+        },
+        {
+            "id": "SAF-15-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index bd4538c28d..6d6ca7ca50 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2038,6 +2038,7 @@ static struct page_info *alloc_color_heap_page(unsigned 
int memflags,

     spin_lock(&heap_lock);

+    /* SAF-14-safe MISRA C R14.3 condition always false without LLC_COLORING */
     for ( i = 0; i < domain_num_llc_colors(d); i++ )
     {
         unsigned long free = free_colored_pages[domain_llc_color(d, i)];
--
2.47.0



 


Rackspace

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