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

[XEN PATCH 03/11] x86/uaccess: move declarations to address MISRA C:2012 Rule 2.1



The variable declarations inside macros {put,get}_unsafe_size are
considered unreachable code, as they appear in a switch statement, before
any clause. They are moved in the enclosing scope to resolve the violation.

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
---
 xen/arch/x86/include/asm/uaccess.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/uaccess.h 
b/xen/arch/x86/include/asm/uaccess.h
index 684fccd95c..a2aaab1e87 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -191,11 +191,12 @@ struct __large_struct { unsigned long buf[100]; };
 
 #define put_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
+    long dummy_;                                                           \
+                                                                           \
     retval = 0;                                                            \
     stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
-    long dummy_;                                                           \
     case 1:                                                                \
         put_unsafe_asm(x, ptr, grd, retval, "b", "b", "iq", errret);       \
         break;                                                             \
@@ -218,11 +219,12 @@ do {                                                      
                 \
 
 #define get_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
+    long dummy_;                                                           \
+                                                                           \
     retval = 0;                                                            \
     stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
-    long dummy_;                                                           \
     case 1: get_unsafe_asm(x, ptr, grd, retval, "b", "=q", errret); break; \
     case 2: get_unsafe_asm(x, ptr, grd, retval, "w", "=r", errret); break; \
     case 4: get_unsafe_asm(x, ptr, grd, retval, "k", "=r", errret); break; \
-- 
2.34.1




 


Rackspace

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