[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xen-cvs
Subject:    [xen master] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
From:       patchbot () xen ! org
Date:       2023-09-26 8:44:11
Message-ID: E1ql3fv-0000IP-FW () xenbits ! xenproject ! org
[Download RAW message or body]

commit 32e13804340ae91c7b633994f53b90396d8c88c6
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 25 10:56:02 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 25 10:56:02 2023 +0200

    xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
    
    Make function declarations and definitions consistent.
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/common/compat/grant_table.c | 22 +++++++++++-----------
 xen/common/compat/memory.c      | 40 ++++++++++++++++++++--------------------
 2 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index f8177c84c0..e00bc24a34 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -57,7 +57,7 @@ CHECK_gnttab_cache_flush;
 #undef xen_gnttab_cache_flush
 
 int compat_grant_table_op(
-    unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) cmp_uop, unsigned int count)
+    unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count)
 {
     int rc = 0;
     unsigned int i, cmd_op;
@@ -71,7 +71,7 @@ int compat_grant_table_op(
     {
 #define CASE(name) \
     case GNTTABOP_##name: \
-        if ( unlikely(!guest_handle_okay(guest_handle_cast(cmp_uop, \
+        if ( unlikely(!guest_handle_okay(guest_handle_cast(uop, \
                                                            \
gnttab_##name##_compat_t), \  count)) ) \
             rc = -EFAULT; \
@@ -119,7 +119,7 @@ int compat_grant_table_op(
 
 #undef CASE
     default:
-        return do_grant_table_op(cmd, cmp_uop, count);
+        return do_grant_table_op(cmd, uop, count);
     }
 
     if ( (int)count < 0 )
@@ -148,7 +148,7 @@ int compat_grant_table_op(
         case GNTTABOP_setup_table:
             if ( unlikely(count > 1) )
                 rc = -EINVAL;
-            else if ( unlikely(__copy_from_guest(&cmp.setup, cmp_uop, 1)) )
+            else if ( unlikely(__copy_from_guest(&cmp.setup, uop, 1)) )
                 rc = -EFAULT;
             else if ( unlikely(!compat_handle_okay(cmp.setup.frame_list, \
cmp.setup.nr_frames)) )  rc = -EFAULT;
@@ -193,7 +193,7 @@ int compat_grant_table_op(
                 } while (0)
                 XLAT_gnttab_setup_table(&cmp.setup, nat.setup);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
-                if ( unlikely(__copy_to_guest(cmp_uop, &cmp.setup, 1)) )
+                if ( unlikely(__copy_to_guest(uop, &cmp.setup, 1)) )
                     rc = -EFAULT;
                 else
                     i = 1;
@@ -203,7 +203,7 @@ int compat_grant_table_op(
         case GNTTABOP_transfer:
             for ( n = 0; n < COMPAT_ARG_XLAT_SIZE / sizeof(*nat.xfer) && i < count \
&& rc == 0; ++i, ++n )  {
-                if ( unlikely(__copy_from_guest_offset(&cmp.xfer, cmp_uop, i, 1)) )
+                if ( unlikely(__copy_from_guest_offset(&cmp.xfer, uop, i, 1)) )
                     rc = -EFAULT;
                 else
                 {
@@ -222,7 +222,7 @@ int compat_grant_table_op(
             {
                 XEN_GUEST_HANDLE_PARAM(gnttab_transfer_compat_t) xfer;
 
-                xfer = guest_handle_cast(cmp_uop, gnttab_transfer_compat_t);
+                xfer = guest_handle_cast(uop, gnttab_transfer_compat_t);
                 guest_handle_add_offset(xfer, i);
                 cnt_uop = guest_handle_cast(xfer, void);
                 while ( n-- )
@@ -237,7 +237,7 @@ int compat_grant_table_op(
         case GNTTABOP_copy:
             for ( n = 0; n < COMPAT_ARG_XLAT_SIZE / sizeof(*nat.copy) && i < count \
&& rc == 0; ++i, ++n )  {
-                if ( unlikely(__copy_from_guest_offset(&cmp.copy, cmp_uop, i, 1)) )
+                if ( unlikely(__copy_from_guest_offset(&cmp.copy, uop, i, 1)) )
                     rc = -EFAULT;
                 else
                 {
@@ -267,7 +267,7 @@ int compat_grant_table_op(
             {
                 XEN_GUEST_HANDLE_PARAM(gnttab_copy_compat_t) copy;
 
-                copy = guest_handle_cast(cmp_uop, gnttab_copy_compat_t);
+                copy = guest_handle_cast(uop, gnttab_copy_compat_t);
                 guest_handle_add_offset(copy, i);
                 cnt_uop = guest_handle_cast(copy, void);
                 while ( n-- )
@@ -285,7 +285,7 @@ int compat_grant_table_op(
                 rc = -EINVAL;
                 break;
             }
-            if ( unlikely(__copy_from_guest(&cmp.get_status, cmp_uop, 1) ||
+            if ( unlikely(__copy_from_guest(&cmp.get_status, uop, 1) ||
                           !compat_handle_okay(cmp.get_status.frame_list,
                                               cmp.get_status.nr_frames)) )
             {
@@ -303,7 +303,7 @@ int compat_grant_table_op(
             if ( rc >= 0 )
             {
                 XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_compat_t) get =
-                    guest_handle_cast(cmp_uop,
+                    guest_handle_cast(uop,
                                       gnttab_get_status_frames_compat_t);
 
                 if ( unlikely(__copy_field_to_guest(get, nat.get_status,
diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c
index 8c34f201c2..45e5fb0e5d 100644
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -54,7 +54,7 @@ static int cf_check get_reserved_device_memory(
 }
 #endif
 
-int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
+int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct vcpu *curr = current;
     struct domain *currd = curr->domain;
@@ -96,7 +96,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) \
compat)  case XENMEM_increase_reservation:
         case XENMEM_decrease_reservation:
         case XENMEM_populate_physmap:
-            if ( copy_from_guest(&cmp.rsrv, compat, 1) )
+            if ( copy_from_guest(&cmp.rsrv, arg, 1) )
                 return start_extent;
 
             /* Is size too large for us to encode a continuation? */
@@ -158,7 +158,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  {
             int order_delta;
 
-            if ( copy_from_guest(&cmp.xchg, compat, 1) )
+            if ( copy_from_guest(&cmp.xchg, arg, 1) )
                 return -EFAULT;
 
             order_delta = cmp.xchg.out.extent_order - cmp.xchg.in.extent_order;
@@ -241,14 +241,14 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  case XENMEM_maximum_reservation:
         case XENMEM_maximum_gpfn:
         case XENMEM_maximum_ram_page:
-            nat.hnd = compat;
+            nat.hnd = arg;
             break;
 
         case XENMEM_add_to_physmap:
             BUILD_BUG_ON((typeof(cmp.atp.size))-1 >
                          (UINT_MAX >> MEMOP_EXTENT_SHIFT));
 
-            if ( copy_from_guest(&cmp.atp, compat, 1) )
+            if ( copy_from_guest(&cmp.atp, arg, 1) )
                 return -EFAULT;
 
             XLAT_add_to_physmap(nat.atp, &cmp.atp);
@@ -271,7 +271,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  enum XLAT_add_to_physmap_batch_u u =
                 XLAT_add_to_physmap_batch_u_res0;
 
-            if ( copy_from_guest(&cmp.atpb, compat, 1) )
+            if ( copy_from_guest(&cmp.atpb, arg, 1) )
                 return -EFAULT;
             size = cmp.atpb.size;
             if ( !compat_handle_okay(cmp.atpb.idxs, size) ||
@@ -322,7 +322,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  
         case XENMEM_remove_from_physmap:
         {
-            if ( copy_from_guest(&cmp.xrfp, compat, 1) )
+            if ( copy_from_guest(&cmp.xrfp, arg, 1) )
                 return -EFAULT;
 
             XLAT_remove_from_physmap(nat.xrfp, &cmp.xrfp);
@@ -331,7 +331,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  }
 
         case XENMEM_access_op:
-            if ( copy_from_guest(&cmp.mao, compat, 1) )
+            if ( copy_from_guest(&cmp.mao, arg, 1) )
                 return -EFAULT;
             
 #define XLAT_mem_access_op_HNDL_pfn_list(_d_, _s_)                      \
@@ -355,7 +355,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  enum XLAT_vnuma_topology_info_vmemrange \
vmemrange =  XLAT_vnuma_topology_info_vmemrange_h;
 
-            if ( copy_from_guest(&cmp.vnuma, compat, 1) )
+            if ( copy_from_guest(&cmp.vnuma, arg, 1) )
                 return -EFAULT;
 
 #define XLAT_vnuma_topology_info_HNDL_vdistance_h(_d_, _s_)		\
@@ -381,7 +381,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  if ( unlikely(start_extent) )
                 return -EINVAL;
 
-            if ( copy_from_guest(&grdm.map, compat, 1) ||
+            if ( copy_from_guest(&grdm.map, arg, 1) ||
                  !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )
                 return -EFAULT;
 
@@ -395,7 +395,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  if ( !rc && grdm.map.nr_entries < \
grdm.used_entries )  rc = -ENOBUFS;
             grdm.map.nr_entries = grdm.used_entries;
-            if ( __copy_to_guest(compat, &grdm.map, 1) )
+            if ( __copy_to_guest(arg, &grdm.map, 1) )
                 rc = -EFAULT;
 
             return rc;
@@ -406,7 +406,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  {
             xen_pfn_t *xen_frame_list = NULL;
 
-            if ( copy_from_guest(&cmp.mar, compat, 1) )
+            if ( copy_from_guest(&cmp.mar, arg, 1) )
                 return -EFAULT;
 
             /* Marshal the frame list in the remainder of the xlat space. */
@@ -470,7 +470,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  break;
         }
         default:
-            return compat_arch_memory_op(cmd, compat);
+            return compat_arch_memory_op(cmd, arg);
         }
 
         rc = do_memory_op(cmd, nat.hnd);
@@ -481,14 +481,14 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  cmp.vnuma.nr_vnodes = nat.vnuma->nr_vnodes;
                 cmp.vnuma.nr_vcpus = nat.vnuma->nr_vcpus;
                 cmp.vnuma.nr_vmemranges = nat.vnuma->nr_vmemranges;
-                if ( __copy_to_guest(compat, &cmp.vnuma, 1) )
+                if ( __copy_to_guest(arg, &cmp.vnuma, 1) )
                     rc = -EFAULT;
             }
             break;
         }
 
         cmd = 0;
-        if ( hypercall_xlat_continuation(&cmd, 2, 0x02, nat.hnd, compat) )
+        if ( hypercall_xlat_continuation(&cmd, 2, 0x02, nat.hnd, arg) )
         {
             BUG_ON(rc != __HYPERVISOR_memory_op);
             BUG_ON((cmd & MEMOP_CMD_MASK) != op);
@@ -573,7 +573,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  }
 
             cmp.xchg.nr_exchanged = nat.xchg->nr_exchanged;
-            if ( __copy_field_to_guest(guest_handle_cast(compat,
+            if ( __copy_field_to_guest(guest_handle_cast(arg,
                                                          compat_memory_exchange_t),
                                        &cmp.xchg, nr_exchanged) )
                 rc = -EFAULT;
@@ -605,7 +605,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  cmp.vnuma.nr_vnodes = nat.vnuma->nr_vnodes;
             cmp.vnuma.nr_vcpus = nat.vnuma->nr_vcpus;
             cmp.vnuma.nr_vmemranges = nat.vnuma->nr_vmemranges;
-            if ( __copy_to_guest(compat, &cmp.vnuma, 1) )
+            if ( __copy_to_guest(arg, &cmp.vnuma, 1) )
                 rc = -EFAULT;
             break;
 
@@ -618,7 +618,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  {
                 ASSERT(split == 0 && rc == 0);
                 if ( __copy_field_to_guest(
-                         guest_handle_cast(compat,
+                         guest_handle_cast(arg,
                                            compat_mem_acquire_resource_t),
                          nat.mar, nr_frames) )
                     return -EFAULT;
@@ -707,7 +707,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  if ( done < nat.mar->nr_frames )
                 return hypercall_create_continuation(
                     __HYPERVISOR_memory_op, "ih",
-                    op | (start_extent << MEMOP_EXTENT_SHIFT), compat);
+                    op | (start_extent << MEMOP_EXTENT_SHIFT), arg);
 
             /*
              * Well... Somethings gone wrong with the two levels of chunking.
@@ -728,7 +728,7 @@ int compat_memory_op(unsigned int cmd, \
XEN_GUEST_HANDLE_PARAM(void) compat)  cmd = op | (start_extent << \
MEMOP_EXTENT_SHIFT);  if ( split > 0 && hypercall_preempt_check() )
             return hypercall_create_continuation(
-                __HYPERVISOR_memory_op, "ih", cmd, compat);
+                __HYPERVISOR_memory_op, "ih", cmd, arg);
     } while ( split > 0 );
 
     if ( unlikely(rc > INT_MAX) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic