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

[PATCH] misra: address Rule 11.3 for NextMemoryDescriptor macro


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Thu, 23 Oct 2025 18:00:12 +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=oxktiCwG7SjR7vO9m0WseD9BnXWQ15fGx/2XbUPLGjE=; b=UfmUqU/vsya5N7Zp97foemKn0iMgFHxYPngT3xfVI/Lc48Loi3HLZ1XxrEqrGmK1/GWYba2VvVIqWRqGDt44oMKWMS5de8zNeGtmvdfhsXJ9k3U/gpvAIvG0ZC/+vgAqI+mvMAz1tNXRTaHT1GUnbfRYqd4aoW7nX4fmDOkai4Iug5YuTRVpiiqBGf41ssjo9kC8E/oJJyRIoKwldAvdkPF+MWD+qwlpFPocPDXwHk0tPtGA9l7aIjh1b/eNz6wzdDyQmJ1bZcXn1cwj/40U7JFkNqIdg6pjRKfQ10YagGq6bANJZhsHBs58JDTFVqcfvk9dRPorXH7FY/KQLkFr2Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L2MHE5U6yBxxz/w0Er2H3Ulz4mhRAhUcEh1V1wtPNVsp9foxwYWkxY11/h/diNoZm4Zl4GnaUxuOli6lKxhYbnOY7nwOMzyATrPG0BRoFD5VuWk7A55CWPkEg8k1EGV23iKg5XT2yi39SexNMe813fcJOVIJO9puVk7IkJs0N7ZZLen9YvVB2JJesD6mZwD/YrHM8YQdomKiT9lKy7yZq+/Hm1+JqtWpH86TZQDjnLrwjqu+zZrQPrHBkToA9Z1zpgfCFOC7B/zqUurAGal2FGAuw90zldD3zEzBQEq0lzQ2uZ2VQOCHMOWVEDKLHDbASmPDC/y/191BkL/jdDf2wg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, 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>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 23 Oct 2025 18:00:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcREbgd161cNZLPEqc4+KUMk5T6A==
  • Thread-topic: [PATCH] misra: address Rule 11.3 for NextMemoryDescriptor macro

Given 'NextMemoryDescriptor()' macro is casting (UINT8 *) pointer to the
(EFI_MEMORY_DESCRIPTOR *) pointer, which is not allowed by the MISRA C
Rule 11.3 as they pointed to the different objects types.

This macro is a part of the EFI imported code ('xen/include/efi/') and
is deviated with a SAF comment.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
 docs/misra/safe.json        | 8 ++++++++
 xen/arch/arm/efi/efi-boot.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 3584cb90c6..c5e193e0f7 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -124,6 +124,14 @@
         },
         {
             "id": "SAF-15-safe",
+            "analyser": {
+                "eclair": "MC3A2.R11.3"
+            },
+            "name": "Rule 11.3: casting a pointer to object into a pointer to 
a different object",
+            "text": "Violation due to the use of 'NextMemoryDescriptor()' 
macro is allowed, as that is EFI imported code."
+        },
+        {
+            "id": "SAF-16-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 7844b9529e..a87004001b 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -227,6 +227,7 @@ static EFI_STATUS __init 
efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
             }
         }
 #endif
+        /* SAF-15-safe casting a pointer */
         desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
     }
 
-- 
2.43.0



 


Rackspace

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