[XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3

Federico Serafini posted 1 patch 8 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/5500643d99b315aa4344e5e3a833e6efa9a0413f.1691737296.git.federico.serafini@bugseng.com
There is a newer version of this series
xen/include/hypercall-defs.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
[XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
Posted by Federico Serafini 8 months, 2 weeks ago
Uniform the auto-generated hypercall-decls with the corresponding
definitions to address violations of MISRA C:2012 Rule 8.3:
"All declarations of an object or function shall use the same names and
type qualifiers".

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/include/hypercall-defs.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 6d361ddfce..4feddce571 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -107,11 +107,16 @@ defhandle: physdev_op_compat_t
 prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm
 physdev_op(int cmd, void *arg)
 
-prefix: do PREFIX_hvm PREFIX_compat
+prefix: do PREFIX_hvm
 #if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
 grant_table_op(unsigned int cmd, void *uop, unsigned int count)
 #endif
 
+prefix: PREFIX_compat
+#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
+grant_table_op(unsigned int cmd, void *cmp_uop, unsigned int count)
+#endif
+
 prefix: do PREFIX_hvm
 memory_op(unsigned long cmd, void *arg)
 
@@ -136,7 +141,7 @@ xenoprof_op(int op, void *arg)
 prefix: compat
 set_timer_op(uint32_t lo, int32_t hi)
 multicall(multicall_entry_compat_t *call_list, uint32_t nr_calls)
-memory_op(unsigned int cmd, void *arg)
+memory_op(unsigned int cmd, void *compat)
 #ifdef CONFIG_IOREQ_SERVER
 dm_op(domid_t domid, unsigned int nr_bufs, void *bufs)
 #endif
@@ -172,7 +177,7 @@ console_io(unsigned int cmd, unsigned int count, char *buffer)
 vm_assist(unsigned int cmd, unsigned int type)
 event_channel_op(int cmd, void *arg)
 mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
-multicall(multicall_entry_t *call_list, unsigned int nr_calls)
+multicall(multicall_entry_t *call_list, uint32_t nr_calls)
 #ifdef CONFIG_PV
 mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
 stack_switch(unsigned long ss, unsigned long esp)
-- 
2.34.1
Re: [XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
Posted by Jan Beulich 8 months, 2 weeks ago
On 11.08.2023 09:06, Federico Serafini wrote:
> @@ -172,7 +177,7 @@ console_io(unsigned int cmd, unsigned int count, char *buffer)
>  vm_assist(unsigned int cmd, unsigned int type)
>  event_channel_op(int cmd, void *arg)
>  mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
> -multicall(multicall_entry_t *call_list, unsigned int nr_calls)
> +multicall(multicall_entry_t *call_list, uint32_t nr_calls)

To be honest I'd say the change wants doing in the definition, to respect
what ./CODING_STYLE has to say in this regard.

Jan
Re: [XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
Posted by Stefano Stabellini 8 months, 2 weeks ago
On Fri, 11 Aug 2023, Federico Serafini wrote:
> Uniform the auto-generated hypercall-decls with the corresponding
> definitions to address violations of MISRA C:2012 Rule 8.3:
> "All declarations of an object or function shall use the same names and
> type qualifiers".
> 
> No functional change.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> ---
>  xen/include/hypercall-defs.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
> index 6d361ddfce..4feddce571 100644
> --- a/xen/include/hypercall-defs.c
> +++ b/xen/include/hypercall-defs.c
> @@ -107,11 +107,16 @@ defhandle: physdev_op_compat_t
>  prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm
>  physdev_op(int cmd, void *arg)
>  
> -prefix: do PREFIX_hvm PREFIX_compat
> +prefix: do PREFIX_hvm
>  #if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
>  grant_table_op(unsigned int cmd, void *uop, unsigned int count)
>  #endif
>  
> +prefix: PREFIX_compat
> +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
> +grant_table_op(unsigned int cmd, void *cmp_uop, unsigned int count)
> +#endif

Everything checks out, so:

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

The other changes are uncontroversial. This one about splitting out the
compat version of grant_table_op is not great. I wonder if it would be
better to rename cmp_uop to uop in xen/common/compat/grant_table.c. I'll
let Jan and the others decide I am OK either way.


>  prefix: do PREFIX_hvm
>  memory_op(unsigned long cmd, void *arg)
>  
> @@ -136,7 +141,7 @@ xenoprof_op(int op, void *arg)
>  prefix: compat
>  set_timer_op(uint32_t lo, int32_t hi)
>  multicall(multicall_entry_compat_t *call_list, uint32_t nr_calls)
> -memory_op(unsigned int cmd, void *arg)
> +memory_op(unsigned int cmd, void *compat)
>  #ifdef CONFIG_IOREQ_SERVER
>  dm_op(domid_t domid, unsigned int nr_bufs, void *bufs)
>  #endif
> @@ -172,7 +177,7 @@ console_io(unsigned int cmd, unsigned int count, char *buffer)
>  vm_assist(unsigned int cmd, unsigned int type)
>  event_channel_op(int cmd, void *arg)
>  mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
> -multicall(multicall_entry_t *call_list, unsigned int nr_calls)
> +multicall(multicall_entry_t *call_list, uint32_t nr_calls)
>  #ifdef CONFIG_PV
>  mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
>  stack_switch(unsigned long ss, unsigned long esp)
> -- 
> 2.34.1
>
Re: [XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
Posted by Jan Beulich 8 months, 2 weeks ago
On 12.08.2023 00:30, Stefano Stabellini wrote:
> On Fri, 11 Aug 2023, Federico Serafini wrote:
>> --- a/xen/include/hypercall-defs.c
>> +++ b/xen/include/hypercall-defs.c
>> @@ -107,11 +107,16 @@ defhandle: physdev_op_compat_t
>>  prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm
>>  physdev_op(int cmd, void *arg)
>>  
>> -prefix: do PREFIX_hvm PREFIX_compat
>> +prefix: do PREFIX_hvm
>>  #if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
>>  grant_table_op(unsigned int cmd, void *uop, unsigned int count)
>>  #endif
>>  
>> +prefix: PREFIX_compat
>> +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
>> +grant_table_op(unsigned int cmd, void *cmp_uop, unsigned int count)
>> +#endif
> 
> Everything checks out, so:
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> The other changes are uncontroversial. This one about splitting out the
> compat version of grant_table_op is not great. I wonder if it would be
> better to rename cmp_uop to uop in xen/common/compat/grant_table.c. I'll
> let Jan and the others decide I am OK either way.

Would there be anything wrong with instead renaming compat_grant_table_op()'s
respective parameter?

Jan
Re: [XEN PATCH] xen/hypercalls: address violations of MISRA C:2012 Rule 8.3
Posted by Federico Serafini 8 months, 2 weeks ago
On 14/08/23 09:14, Jan Beulich wrote:
> On 12.08.2023 00:30, Stefano Stabellini wrote:
>> On Fri, 11 Aug 2023, Federico Serafini wrote:
>>> --- a/xen/include/hypercall-defs.c
>>> +++ b/xen/include/hypercall-defs.c
>>> @@ -107,11 +107,16 @@ defhandle: physdev_op_compat_t
>>>   prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm
>>>   physdev_op(int cmd, void *arg)
>>>   
>>> -prefix: do PREFIX_hvm PREFIX_compat
>>> +prefix: do PREFIX_hvm
>>>   #if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
>>>   grant_table_op(unsigned int cmd, void *uop, unsigned int count)
>>>   #endif
>>>   
>>> +prefix: PREFIX_compat
>>> +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
>>> +grant_table_op(unsigned int cmd, void *cmp_uop, unsigned int count)
>>> +#endif
>>
>> Everything checks out, so:
>>
>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>>
>> The other changes are uncontroversial. This one about splitting out the
>> compat version of grant_table_op is not great. I wonder if it would be
>> better to rename cmp_uop to uop in xen/common/compat/grant_table.c. I'll
>> let Jan and the others decide I am OK either way.
> 
> Would there be anything wrong with instead renaming compat_grant_table_op()'s
> respective parameter?
> 
> Jan

As far as I know, there would be nothing wrong with MISRA.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)