[PATCH] arm/tee: rename variable to address MISRA C Rule 5.3

Dmytro Prokopchuk1 posted 1 patch 3 days, 22 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/e7fd1f75146e7faa520414c4ffc1bd9572914039.1773951370.git.dmytro._5Fprokopchuk1@epam.com
xen/arch/arm/tee/ffa_partinfo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[PATCH] arm/tee: rename variable to address MISRA C Rule 5.3
Posted by Dmytro Prokopchuk1 3 days, 22 hours ago
The local variable 'ffa_vm_count' shadows the global variable, declared
in 'xen/arch/arm/tee/ffa_private.h', therefore it is renamed
'ffa_vm2vm_count'.

No functional change.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
 xen/arch/arm/tee/ffa_partinfo.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index fdb03dae9a..473507ca3a 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -265,7 +265,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
     uint32_t dst_size = 0;
     size_t buf_size;
     void *dst_buf, *end_buf;
-    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
+    uint32_t ffa_vm2vm_count = 0, ffa_sp_count = 0;
 
     ffa_uuid_set(&uuid,
              get_user_reg(regs, 1),
@@ -310,7 +310,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
          */
         if ( ffa_uuid_is_nil(uuid) )
         {
-            ffa_vm_count = get_ffa_vm_count();
+            ffa_vm2vm_count = get_ffa_vm_count();
 
             /*
              * Workaround for Linux FF-A Driver not accepting to have its own
@@ -320,7 +320,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
              * the requester endpoint information should be included or not
              */
             if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
-                ffa_vm_count -= 1;
+                ffa_vm2vm_count -= 1;
         }
 
         goto out;
@@ -355,7 +355,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, &ffa_vm2vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
@@ -370,7 +370,7 @@ out:
         if ( flags || ACCESS_ONCE(ctx->guest_vers) == FFA_VERSION_1_0 )
             dst_size = 0;
 
-        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm_count, dst_size);
+        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm2vm_count, dst_size);
     }
 }
 
-- 
2.43.0
Re: [PATCH] arm/tee: rename variable to address MISRA C Rule 5.3
Posted by Bertrand Marquis 3 days, 10 hours ago
Hi Dmytro,


> On 19 Mar 2026, at 21:16, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
> 
> The local variable 'ffa_vm_count' shadows the global variable, declared
> in 'xen/arch/arm/tee/ffa_private.h', therefore it is renamed
> 'ffa_vm2vm_count'.

I have a patch in my queue to solve this (I am just removing the ffa_ prefix from the local
variables but does the same as yours) and a patch to solve the other misra issue in optee
but happy to to use yours if you want instead.

I was waiting for the pending ffa serie to push them (should be merge soon)

This patch will not rebase cleanly on top of that serie which is changing ffa_partinfo code.

Do you want to wait and rebase or abandon and use the one in my serie instead ?

I am ok with either solution :-)

Cheers
Bertrand

> 
> No functional change.
> 
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
> ---
> xen/arch/arm/tee/ffa_partinfo.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
> index fdb03dae9a..473507ca3a 100644
> --- a/xen/arch/arm/tee/ffa_partinfo.c
> +++ b/xen/arch/arm/tee/ffa_partinfo.c
> @@ -265,7 +265,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
>     uint32_t dst_size = 0;
>     size_t buf_size;
>     void *dst_buf, *end_buf;
> -    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
> +    uint32_t ffa_vm2vm_count = 0, ffa_sp_count = 0;
> 
>     ffa_uuid_set(&uuid,
>              get_user_reg(regs, 1),
> @@ -310,7 +310,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
>          */
>         if ( ffa_uuid_is_nil(uuid) )
>         {
> -            ffa_vm_count = get_ffa_vm_count();
> +            ffa_vm2vm_count = get_ffa_vm_count();
> 
>             /*
>              * Workaround for Linux FF-A Driver not accepting to have its own
> @@ -320,7 +320,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
>              * the requester endpoint information should be included or not
>              */
>             if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
> -                ffa_vm_count -= 1;
> +                ffa_vm2vm_count -= 1;
>         }
> 
>         goto out;
> @@ -355,7 +355,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
>             goto out_rx_release;
>     }
> 
> -    ret = ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf,
> +    ret = ffa_get_vm_partinfo(uuid, &ffa_vm2vm_count, &dst_buf, end_buf,
>                               dst_size);
> 
> out_rx_release:
> @@ -370,7 +370,7 @@ out:
>         if ( flags || ACCESS_ONCE(ctx->guest_vers) == FFA_VERSION_1_0 )
>             dst_size = 0;
> 
> -        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm_count, dst_size);
> +        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm2vm_count, dst_size);
>     }
> }
> 
> -- 
> 2.43.0
Re: [PATCH] arm/tee: rename variable to address MISRA C Rule 5.3
Posted by Dmytro Prokopchuk1 3 days, 9 hours ago

On 3/20/26 09:44, Bertrand Marquis wrote:
> Hi Dmytro,
> 
> 
>> On 19 Mar 2026, at 21:16, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
>>
>> The local variable 'ffa_vm_count' shadows the global variable, declared
>> in 'xen/arch/arm/tee/ffa_private.h', therefore it is renamed
>> 'ffa_vm2vm_count'.
> 
> I have a patch in my queue to solve this (I am just removing the ffa_ prefix from the local
> variables but does the same as yours) and a patch to solve the other misra issue in optee
> but happy to to use yours if you want instead.
> 
> I was waiting for the pending ffa serie to push them (should be merge soon)
> 
> This patch will not rebase cleanly on top of that serie which is changing ffa_partinfo code.
> 
> Do you want to wait and rebase or abandon and use the one in my serie instead ?
> 
> I am ok with either solution :-)
> 
> Cheers
> Bertrand

Hi Bertrand,

lets use your patch series.

BR, Dmytro.
Re: [PATCH] arm/tee: rename variable to address MISRA C Rule 5.3
Posted by Bertrand Marquis 3 days, 9 hours ago

> On 20 Mar 2026, at 09:54, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
> 
> 
> 
> On 3/20/26 09:44, Bertrand Marquis wrote:
>> Hi Dmytro,
>> 
>> 
>>> On 19 Mar 2026, at 21:16, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
>>> 
>>> The local variable 'ffa_vm_count' shadows the global variable, declared
>>> in 'xen/arch/arm/tee/ffa_private.h', therefore it is renamed
>>> 'ffa_vm2vm_count'.
>> 
>> I have a patch in my queue to solve this (I am just removing the ffa_ prefix from the local
>> variables but does the same as yours) and a patch to solve the other misra issue in optee
>> but happy to to use yours if you want instead.
>> 
>> I was waiting for the pending ffa serie to push them (should be merge soon)
>> 
>> This patch will not rebase cleanly on top of that serie which is changing ffa_partinfo code.
>> 
>> Do you want to wait and rebase or abandon and use the one in my serie instead ?
>> 
>> I am ok with either solution :-)
>> 
>> Cheers
>> Bertrand
> 
> Hi Bertrand,
> 
> lets use your patch series.

I just sent it with a warning in the cover letter for its base.

Cheers
Bertrand
Re: [PATCH] arm/tee: rename variable to address MISRA C Rule 5.3
Posted by Nicola Vetrini 3 days, 19 hours ago
On 2026-03-19 21:16, Dmytro Prokopchuk1 wrote:
> The local variable 'ffa_vm_count' shadows the global variable, declared
> in 'xen/arch/arm/tee/ffa_private.h', therefore it is renamed
> 'ffa_vm2vm_count'.
> 
> No functional change.
> 
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>

Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

minor nit: it could be useful to add a link to a successful CI pipeline 
for more complex cases

> ---
>  xen/arch/arm/tee/ffa_partinfo.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/tee/ffa_partinfo.c 
> b/xen/arch/arm/tee/ffa_partinfo.c
> index fdb03dae9a..473507ca3a 100644
> --- a/xen/arch/arm/tee/ffa_partinfo.c
> +++ b/xen/arch/arm/tee/ffa_partinfo.c
> @@ -265,7 +265,7 @@ void ffa_handle_partition_info_get(struct 
> cpu_user_regs *regs)
>      uint32_t dst_size = 0;
>      size_t buf_size;
>      void *dst_buf, *end_buf;
> -    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
> +    uint32_t ffa_vm2vm_count = 0, ffa_sp_count = 0;
> 
>      ffa_uuid_set(&uuid,
>               get_user_reg(regs, 1),
> @@ -310,7 +310,7 @@ void ffa_handle_partition_info_get(struct 
> cpu_user_regs *regs)
>           */
>          if ( ffa_uuid_is_nil(uuid) )
>          {
> -            ffa_vm_count = get_ffa_vm_count();
> +            ffa_vm2vm_count = get_ffa_vm_count();
> 
>              /*
>               * Workaround for Linux FF-A Driver not accepting to have 
> its own
> @@ -320,7 +320,7 @@ void ffa_handle_partition_info_get(struct 
> cpu_user_regs *regs)
>               * the requester endpoint information should be included 
> or not
>               */
>              if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
> -                ffa_vm_count -= 1;
> +                ffa_vm2vm_count -= 1;
>          }
> 
>          goto out;
> @@ -355,7 +355,7 @@ void ffa_handle_partition_info_get(struct 
> cpu_user_regs *regs)
>              goto out_rx_release;
>      }
> 
> -    ret = ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf,
> +    ret = ffa_get_vm_partinfo(uuid, &ffa_vm2vm_count, &dst_buf, 
> end_buf,
>                                dst_size);
> 
>  out_rx_release:
> @@ -370,7 +370,7 @@ out:
>          if ( flags || ACCESS_ONCE(ctx->guest_vers) == FFA_VERSION_1_0 
> )
>              dst_size = 0;
> 
> -        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm_count, 
> dst_size);
> +        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm2vm_count, 
> dst_size);
>      }
>  }

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253