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

[XEN PATCH 2/4] x86/emulate: move a variable declaration to address MISRA C:2012 Rule 5.3



The declaration of local variable 'bytes' in 'hvmemul_rep_stos' causes
the shadowing of the same variable defined in the enclosing scope,
hence the declaration has been moved inside the scope where it's used,
with a different name.

Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 75ee98a73b..0d41928ff3 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2024,15 +2024,15 @@ static int cf_check hvmemul_rep_stos(
 
     switch ( p2mt )
     {
-        unsigned long bytes;
         char *buf;
 
     default:
         /* Allocate temporary buffer. */
         for ( ; ; )
         {
-            bytes = *reps * bytes_per_rep;
-            buf = xmalloc_bytes(bytes);
+            unsigned long bytes_tmp;
+            bytes_tmp = *reps * bytes_per_rep;
+            buf = xmalloc_bytes(bytes_tmp);
             if ( buf || *reps <= 1 )
                 break;
             *reps >>= 1;
-- 
2.34.1




 


Rackspace

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