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

[PATCH] x86/emul: Adjust get_stub() to avoid shadowing an outer variable



Eclair reports a violation of MISRA Rule 5.3.

get_stub() has a local ptr variable which genuinely shadows x86_emul_rmw()'s
parameter of the same name.  The logic is correct, so the easiest fix is to
rename one of variables.

With this addressed, Rule 5.3 is clean, so mark it as such.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: consulting@xxxxxxxxxxx <consulting@xxxxxxxxxxx>

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1545385154
---
 automation/eclair_analysis/ECLAIR/tagging.ecl |  1 +
 xen/arch/x86/x86_emulate/private.h            | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl 
b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 16e7adb61fe8..9318e5b10ca8 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -35,6 +35,7 @@ MC3R1.R4.1||
 MC3R1.R4.2||
 MC3R1.R5.1||
 MC3R1.R5.2||
+MC3R1.R5.3||
 MC3R1.R5.4||
 MC3R1.R5.6||
 MC3R1.R6.1||
diff --git a/xen/arch/x86/x86_emulate/private.h 
b/xen/arch/x86/x86_emulate/private.h
index 172270a458bd..ef4745f56e27 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -672,19 +672,19 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 # include <asm/uaccess.h>
 
 # define get_stub(stb) ({                                    \
-    void *ptr;                                               \
+    void *_ptr;                                              \
     BUILD_BUG_ON(STUB_BUF_SIZE / 2 < MAX_INST_LEN + 1);      \
     ASSERT(!(stb).ptr);                                      \
     (stb).addr = this_cpu(stubs.addr) + STUB_BUF_SIZE / 2;   \
     (stb).ptr = map_domain_page(_mfn(this_cpu(stubs.mfn))) + \
         ((stb).addr & ~PAGE_MASK);                           \
-    ptr = memset((stb).ptr, 0xcc, STUB_BUF_SIZE / 2);        \
+    _ptr = memset((stb).ptr, 0xcc, STUB_BUF_SIZE / 2);       \
     if ( cpu_has_xen_ibt )                                   \
     {                                                        \
-        place_endbr64(ptr);                                  \
-        ptr += 4;                                            \
+        place_endbr64(_ptr);                                 \
+        _ptr += 4;                                           \
     }                                                        \
-    ptr;                                                     \
+    _ptr;                                                    \
 })
 
 # define put_stub(stb) ({             \

base-commit: d2bbb0d4554aa08649985d790317ba78f0db22ff
-- 
2.39.5




 


Rackspace

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