Skip to contentSkip to conversation

Address violations of MISRA C:2012 Rule 8.3

PATCH In review Federico Serafini 3 participants 12 messages Sep 29, 2023 – Oct 16, 2023

lore
Share & tools
lore
#0 lore raw

cover Address violations of MISRA C:2012 Rule 8.3

This series contains small and uncontroversial patches to address some violations of Rule 8.3.
No functonal changes are introduced.

Federico Serafini (4):
video/vesa: drop bool_t
x86/uaccess: address violations of MISRA C:2012 Rule 8.3 x86/xstate: address a violation of MISRA C:2012 Rule 8.3 x86/psr: address a violation of MISRA C:2012 Rule 8.3

 xen/arch/x86/include/asm/psr.h     | 2 +-
 xen/arch/x86/include/asm/uaccess.h | 6 +++---
 xen/arch/x86/xstate.c              | 8 ++++----
 xen/drivers/video/vesa.c           | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 video/vesa: drop bool_t

Drop bool_t to make function declaration and definition consistent and address a violation of MISRA C:2012 Rule 8.3.
No functional change.

---
 xen/drivers/video/vesa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/video/vesa.c +1 -1
index b007ff5678..70feca21ac 100644
@@ -145,7 +145,7 @@ static void cf_check lfb_flush(void)
     __asm__ __volatile__ ("sfence" : : : "memory");
 }
 
-void __init vesa_endboot(bool_t keep)
+void __init vesa_endboot(bool keep)
 {
     if ( keep )
     {
Signature · 1 line
2.34.1
#2 lore raw

Re: [XEN PATCH 1/4] video/vesa: drop bool_t

Quoted 14 lines · Federico Serafini

Drop bool_t to make function declaration and definition consistent and address a violation of MISRA C:2012 Rule 8.3.
No functional change.

---
  xen/drivers/video/vesa.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/video/vesa.c +0 -0
index b007ff5678..70feca21ac 100644

xen/drivers/video/vesa.c static void cf_check lfb_flush(void) · line 151

Quoted 8 lines
xen/drivers/video/vesa.c +1 -1
@@ -145,7 +145,7 @@ static void cf_check lfb_flush(void)
      __asm__ __volatile__ ("sfence" : : : "memory");
  }
 
-void __init vesa_endboot(bool_t keep)
+void __init vesa_endboot(bool keep)
  {
      if ( keep )
      {

I am seeing that there is an acked patch that solves this, so this patch should be dropped.

Signature · 3 lines
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)
#3 lore raw

PATCH 2/4 x86/uaccess: address violations of MISRA C:2012 Rule 8.3

In reply to Federico Serafini

Make function declarations and definitions consistent. No functional change.

---
 xen/arch/x86/include/asm/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/include/asm/uaccess.h +3 -3
index 684fccd95c..7443519d5b 100644
@@ -10,10 +10,10 @@
 #include <asm/x86_64/uaccess.h>
 
 unsigned int copy_to_guest_pv(void __user *to, const void *from,
-                              unsigned int len);
-unsigned int clear_guest_pv(void __user *to, unsigned int len);
+                              unsigned int n);
+unsigned int clear_guest_pv(void __user *to, unsigned int n);
 unsigned int copy_from_guest_pv(void *to, const void __user *from,
-                                unsigned int len);
+                                unsigned int n);
 
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 unsigned int copy_to_guest_ll(void __user*to, const void *from, unsigned int n);
Signature · 1 line
2.34.1
#6 lore raw

PATCH 3/4 x86/xstate: address a violation of MISRA C:2012 Rule 8.3

In reply to Federico Serafini

Make function declaration and definition consistent. No functional change.

---
 xen/arch/x86/xstate.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/x86/xstate.c +4 -4
index f442610fc5..cf94761d05 100644
@@ -54,16 +54,16 @@ static inline bool xsetbv(u32 index, u64 xfeatures)
     return lo != 0;
 }
 
-bool set_xcr0(u64 val)
+bool set_xcr0(u64 xfeatures)
 {
     uint64_t *this_xcr0 = &this_cpu(xcr0);
 
-    if ( *this_xcr0 != val )
+    if ( *this_xcr0 != xfeatures )
     {
-        if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, val) )
+        if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures) )
             return false;
 
-        *this_xcr0 = val;
+        *this_xcr0 = xfeatures;
     }
 
     return true;
Signature · 1 line
2.34.1
#9 lore raw

PATCH 4/4 x86/psr: address a violation of MISRA C:2012 Rule 8.3

In reply to Federico Serafini

Make function declaration and definition consistent. No functional change.

---
 xen/arch/x86/include/asm/psr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/psr.h +1 -1
index c2257da7fc..8ecb7a0eea 100644
@@ -81,7 +81,7 @@ int psr_get_info(unsigned int socket, enum psr_type type,
 int psr_get_val(struct domain *d, unsigned int socket,
                 uint32_t *val, enum psr_type type);
 int psr_set_val(struct domain *d, unsigned int socket,
-                uint64_t val, enum psr_type type);
+                uint64_t new_val, enum psr_type type);
 
 void psr_domain_init(struct domain *d);
 void psr_domain_free(struct domain *d);
Signature · 1 line
2.34.1