[PATCH 1/2] xen/arm: ffa: Fix local ffa_vm_count shadowing

Bertrand Marquis posted 2 patches 3 days, 10 hours ago
[PATCH 1/2] xen/arm: ffa: Fix local ffa_vm_count shadowing
Posted by Bertrand Marquis 3 days, 10 hours ago
ffa_handle_partition_info_get() declares a local variable named
ffa_vm_count, which hides the global atomic ffa_vm_count declared in
ffa_private.h.

This triggered the ECLAIR Rule 5.3 finding "non-compliant local variable
`ffa_vm_count'".

Rename the local counters to vm_count and sp_count and update their
uses.

No functional changes.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/tee/ffa_partinfo.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 4580bd5edb65..ed28820502f8 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -346,7 +346,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 vm_count = 0, sp_count = 0;
 
     ffa_uuid_set(&uuid,
              get_user_reg(regs, 1),
@@ -380,7 +380,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
         if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
         {
-            ret = ffa_get_sp_count(uuid, &ffa_sp_count);
+            ret = ffa_get_sp_count(uuid, &sp_count);
             if ( ret )
                 goto out;
         }
@@ -391,7 +391,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();
+            vm_count = get_ffa_vm_count();
 
             /*
              * Workaround for Linux FF-A Driver not accepting to have its own
@@ -401,7 +401,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;
+                vm_count -= 1;
         }
 
         goto out;
@@ -429,14 +429,14 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
     if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
     {
-        ret = ffa_get_sp_partinfo(uuid, &ffa_sp_count, &dst_buf, end_buf,
+        ret = ffa_get_sp_partinfo(uuid, &sp_count, &dst_buf, end_buf,
                                   dst_size);
 
         if ( ret )
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, 0, &vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
@@ -451,7 +451,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, sp_count + vm_count, dst_size);
     }
 }
 
-- 
2.52.0
Re: [PATCH 1/2] xen/arm: ffa: Fix local ffa_vm_count shadowing
Posted by Jens Wiklander 3 days, 4 hours ago
On Fri, Mar 20, 2026 at 10:07 AM Bertrand Marquis
<bertrand.marquis@arm.com> wrote:
>
> ffa_handle_partition_info_get() declares a local variable named
> ffa_vm_count, which hides the global atomic ffa_vm_count declared in
> ffa_private.h.
>
> This triggered the ECLAIR Rule 5.3 finding "non-compliant local variable
> `ffa_vm_count'".
>
> Rename the local counters to vm_count and sp_count and update their
> uses.
>
> No functional changes.
>
> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
> ---
>  xen/arch/arm/tee/ffa_partinfo.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Cheers,
Jens
Re: [PATCH 1/2] xen/arm: ffa: Fix local ffa_vm_count shadowing
Posted by Orzel, Michal 3 days, 10 hours ago

On 20/03/2026 10:07, Bertrand Marquis wrote:
> ffa_handle_partition_info_get() declares a local variable named
> ffa_vm_count, which hides the global atomic ffa_vm_count declared in
> ffa_private.h.
> 
> This triggered the ECLAIR Rule 5.3 finding "non-compliant local variable
> `ffa_vm_count'".
> 
> Rename the local counters to vm_count and sp_count and update their
> uses.
> 
> No functional changes.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal