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

[xen master] libelf: address MISRA C:2012 Rule 5.3



commit d63ea6c46b89bffb99647871c788c236a8286646
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Mon Aug 7 11:25:02 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 7 11:26:43 2023 +0200

    libelf: address MISRA C:2012 Rule 5.3
    
    The types u{8,16,32,64} defined in 'xen/arch/x86/include/asm/types.h'
    shadow the variables in the modified function, hence violating Rule 5.3.
    Therefore, the rename takes care of the shadowing.
    
    No functional changes.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/common/libelf/libelf-tools.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/common/libelf/libelf-tools.c b/xen/common/libelf/libelf-tools.c
index a9edb6a8dc..b847969da9 100644
--- a/xen/common/libelf/libelf-tools.c
+++ b/xen/common/libelf/libelf-tools.c
@@ -91,10 +91,10 @@ uint64_t elf_access_unsigned(struct elf_binary * elf, 
elf_ptrval base,
 {
     elf_ptrval ptrval = base + moreoffset;
     bool need_swap = elf_swap(elf);
-    const uint8_t *u8;
-    const uint16_t *u16;
-    const uint32_t *u32;
-    const uint64_t *u64;
+    const uint8_t *pu8;
+    const uint16_t *pu16;
+    const uint32_t *pu32;
+    const uint64_t *pu64;
 
     if ( !elf_access_ok(elf, ptrval, size) )
         return 0;
@@ -102,17 +102,17 @@ uint64_t elf_access_unsigned(struct elf_binary * elf, 
elf_ptrval base,
     switch ( size )
     {
     case 1:
-        u8 = (const void*)ptrval;
-        return *u8;
+        pu8 = (const void *)ptrval;
+        return *pu8;
     case 2:
-        u16 = (const void*)ptrval;
-        return need_swap ? bswap_16(*u16) : *u16;
+        pu16 = (const void *)ptrval;
+        return need_swap ? bswap_16(*pu16) : *pu16;
     case 4:
-        u32 = (const void*)ptrval;
-        return need_swap ? bswap_32(*u32) : *u32;
+        pu32 = (const void *)ptrval;
+        return need_swap ? bswap_32(*pu32) : *pu32;
     case 8:
-        u64 = (const void*)ptrval;
-        return need_swap ? bswap_64(*u64) : *u64;
+        pu64 = (const void *)ptrval;
+        return need_swap ? bswap_64(*pu64) : *pu64;
     default:
         return 0;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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