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

Re: [XEN PATCH v2 1/3] xen/common: address MISRA C:2012 Rule 5.3



On 01/08/2023 15:33, Jan Beulich wrote:
On 01.08.2023 14:47, Nicola Vetrini wrote:
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -81,6 +81,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
             struct compat_memory_exchange xchg;
             struct compat_add_to_physmap atp;
             struct compat_add_to_physmap_batch atpb;
+            struct compat_remove_from_physmap rmfp;
             struct compat_vnuma_topology_info vnuma;
             struct compat_mem_access_op mao;
             struct compat_mem_acquire_resource mar;
@@ -321,12 +322,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)

         case XENMEM_remove_from_physmap:
         {
-            struct compat_remove_from_physmap cmp;
-
-            if ( copy_from_guest(&cmp, compat, 1) )
+            if ( copy_from_guest(&cmp.rmfp, compat, 1) )
                 return -EFAULT;

-            XLAT_remove_from_physmap(nat.xrfp, &cmp);
+            XLAT_remove_from_physmap(nat.xrfp, &cmp.rmfp);

Is there a reason not to use the same name in the compat union as is
used in the native one, like all other members do?


No, I just didn't notice there was a native remove_from_physmap field
when choosing the name.

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

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