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

[XEN PATCH v2 2/3] device-tree: address violation of MISRA C Rule 5.5


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Wed, 9 Jul 2025 21:38:19 +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=Z3ukeX3wq+UElyvs0FOh6d1EvTnkp8JXBecye8XWal4=; b=yV7ZYit4coHbhTshmyUlN4wPBgQv76g49JTlarWdDvdbA2dNFsZf0L8ND6TGxvDu4HlqDR0FFv8EerYQdWWdyeLiuJtMV1j2r23QyUAsAwmC08wPuzyOseGDfjFf77XNBusUf5IPR+QBHnQA6XsELKJ+olWuRsx45F+lqGY3kkjRpsPbJ+U6KyAoEzQvBTuZ2NJT5VtMH6yHO+FRR9RvLKUyDZwICBoz75mGdk5MYVqiPlmh4iymqE7LinUYdh0PdtK8FFE5LemTMnefr/RZRtlRDYw6EJXjvR0byUCv2Ycv0J7UTfrJp8eGbIbfu+iGqv5+rJrxBsai+LD9A2ktAQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SVoNQ1vLC0wHcQ/ARfWRtWEWXXcfDxpxLnb9WigkvjmhVcrfiQjOTsRON+XCCcvbHTgGaLGW++PKSTJ+JtZUaaOwFIsrQ0iOJE/arCDQ5oOCG7ROI+Rvb/aLejcSiNQbTwrBjQ+4yRYme4Ezfhll7W+RvuAZ1+xK5u/IMVaGiHuYRXWPXjs6Tj7STqsqCTDiPlBTt6A5efYy8ySaH7xMfpc58rxH+BdGcUcdZkXFcRWg/uoh8yPC1VkwAlbVs4KD9Vx1xeAPbg9d7lTphf27ab4I9dW1o0jv4dgsZj4CV8jqJA6OcvyUVL5hub8GscKhVlWKQWNb+TJj/Jjg/M71Zw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 09 Jul 2025 21:38:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb8RnJ3I3XBASNWkufF4wQbiQgCw==
  • Thread-topic: [XEN PATCH v2 2/3] device-tree: address violation of MISRA C Rule 5.5

Address a violation of MISRA C:2012 Rule 5.5:
"Identifiers shall be distinct from macro names".

Reports for service MC3A2.R5.5:
xen/include/xen/fdt-domain-build.h: non-compliant parameter 'copy_to_guest'
xen/include/xen/guest_access.h: non-compliant macro 'copy_to_guest'

Rename 'copy_to_guest' function parameter to 'cb' for compliance.
No functional changes.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/common/device-tree/domain-build.c | 13 ++++++-------
 xen/include/xen/fdt-domain-build.h    |  4 ++--
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/xen/common/device-tree/domain-build.c 
b/xen/common/device-tree/domain-build.c
index e6d7b8961e..4eea095e49 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -336,7 +336,7 @@ void __init allocate_memory(struct domain *d, struct 
kernel_info *kinfo)
 }
 
 void __init dtb_load(struct kernel_info *kinfo,
-                     copy_to_guest_phys_cb copy_to_guest)
+                     copy_to_guest_phys_cb cb)
 {
     unsigned long left;
 
@@ -344,9 +344,9 @@ void __init dtb_load(struct kernel_info *kinfo,
            kinfo->d, kinfo->dtb_paddr,
            kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt));
 
-    left = copy_to_guest(kinfo->d, kinfo->dtb_paddr,
-                         kinfo->fdt,
-                         fdt_totalsize(kinfo->fdt));
+    left = cb(kinfo->d, kinfo->dtb_paddr,
+              kinfo->fdt,
+              fdt_totalsize(kinfo->fdt));
 
     if ( left != 0 )
         panic("Unable to copy the DTB to %pd memory (left = %lu bytes)\n",
@@ -355,7 +355,7 @@ void __init dtb_load(struct kernel_info *kinfo,
 }
 
 void __init initrd_load(struct kernel_info *kinfo,
-                        copy_to_guest_phys_cb copy_to_guest)
+                        copy_to_guest_phys_cb cb)
 {
     const struct boot_module *mod = kinfo->initrd;
     paddr_t load_addr = kinfo->initrd_paddr;
@@ -398,8 +398,7 @@ void __init initrd_load(struct kernel_info *kinfo,
     if ( !initrd )
         panic("Unable to map the %pd initrd\n", kinfo->d);
 
-    res = copy_to_guest(kinfo->d, load_addr,
-                        initrd, len);
+    res = cb(kinfo->d, load_addr, initrd, len);
     if ( res != 0 )
         panic("Unable to copy the initrd in the %pd memory\n", kinfo->d);
 
diff --git a/xen/include/xen/fdt-domain-build.h 
b/xen/include/xen/fdt-domain-build.h
index 45981dbec0..3a20623cf5 100644
--- a/xen/include/xen/fdt-domain-build.h
+++ b/xen/include/xen/fdt-domain-build.h
@@ -50,10 +50,10 @@ typedef unsigned long (*copy_to_guest_phys_cb)(struct 
domain *d,
                                                unsigned int len);
 
 void initrd_load(struct kernel_info *kinfo,
-                 copy_to_guest_phys_cb copy_to_guest);
+                 copy_to_guest_phys_cb cb);
 
 void dtb_load(struct kernel_info *kinfo,
-              copy_to_guest_phys_cb copy_to_guest);
+              copy_to_guest_phys_cb cb);
 
 int find_unallocated_memory(const struct kernel_info *kinfo,
                             const struct membanks *mem_banks[],
-- 
2.43.0



 


Rackspace

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