diff mbox series

[XEN,v4,1/2] x86/mm: preparation work to uniform modify_xen_mappings* interfaces

Message ID 8f318ade9277b316a6f91df3b75a593d662ac586.1700645120.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series xen/mm: address violatios of MISRA C:2012 Rules 8.2 and 8.3 | expand

Commit Message

Federico Serafini Nov. 22, 2023, 9:51 a.m. UTC
The objective is to use parameter name "nf" to denote "new flags"
in all the modify_xen_mappings* functions.
Since modify_xen_mappings_lite() is currently using "nf" as identifier
for a local variable, bad things could happen if new uses of such
variable are committed while a renaming patch is waiting for the
approval.
To avoid such danger, as first thing rename the local variable from
"nf" to "flags".

No functional change.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/x86/mm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini Nov. 22, 2023, 10:20 p.m. UTC | #1
On Wed, 22 Nov 2023, Federico Serafini wrote:
> The objective is to use parameter name "nf" to denote "new flags"
> in all the modify_xen_mappings* functions.
> Since modify_xen_mappings_lite() is currently using "nf" as identifier
> for a local variable, bad things could happen if new uses of such
> variable are committed while a renaming patch is waiting for the
> approval.
> To avoid such danger, as first thing rename the local variable from
> "nf" to "flags".
> 
> No functional change.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Jan Beulich Nov. 27, 2023, 1:18 p.m. UTC | #2
On 22.11.2023 23:20, Stefano Stabellini wrote:
> On Wed, 22 Nov 2023, Federico Serafini wrote:
>> The objective is to use parameter name "nf" to denote "new flags"
>> in all the modify_xen_mappings* functions.
>> Since modify_xen_mappings_lite() is currently using "nf" as identifier
>> for a local variable, bad things could happen if new uses of such
>> variable are committed while a renaming patch is waiting for the
>> approval.
>> To avoid such danger, as first thing rename the local variable from
>> "nf" to "flags".
>>
>> No functional change.
>>
>> Suggested-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 39544bd9f9..42c957c40e 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5903,15 +5903,15 @@  int destroy_xen_mappings(unsigned long s, unsigned long e)
 void init_or_livepatch modify_xen_mappings_lite(
     unsigned long s, unsigned long e, unsigned int _nf)
 {
-    unsigned long v = s, fm, nf;
+    unsigned long v = s, fm, flags;
 
     /* Set of valid PTE bits which may be altered. */
 #define FLAGS_MASK (_PAGE_NX|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW|_PAGE_PRESENT)
     fm = put_pte_flags(FLAGS_MASK);
-    nf = put_pte_flags(_nf & FLAGS_MASK);
+    flags = put_pte_flags(_nf & FLAGS_MASK);
 #undef FLAGS_MASK
 
-    ASSERT(nf & _PAGE_PRESENT);
+    ASSERT(flags & _PAGE_PRESENT);
     ASSERT(IS_ALIGNED(s, PAGE_SIZE) && s >= XEN_VIRT_START);
     ASSERT(IS_ALIGNED(e, PAGE_SIZE) && e <= XEN_VIRT_END);
 
@@ -5925,7 +5925,7 @@  void init_or_livepatch modify_xen_mappings_lite(
 
         if ( l2e_get_flags(l2e) & _PAGE_PSE )
         {
-            l2e_write_atomic(pl2e, l2e_from_intpte((l2e.l2 & ~fm) | nf));
+            l2e_write_atomic(pl2e, l2e_from_intpte((l2e.l2 & ~fm) | flags));
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             continue;
@@ -5943,7 +5943,8 @@  void init_or_livepatch modify_xen_mappings_lite(
 
                 ASSERT(l1f & _PAGE_PRESENT);
 
-                l1e_write_atomic(pl1e, l1e_from_intpte((l1e.l1 & ~fm) | nf));
+                l1e_write_atomic(pl1e,
+                                 l1e_from_intpte((l1e.l1 & ~fm) | flags));
 
                 v += 1UL << L1_PAGETABLE_SHIFT;