Skip to contentSkip to conversation

xen: address violations of MISRA C:2012 Rule 8.2

PATCH In review Federico Serafini 3 participants 29 messages Nov 24, 2023 – Dec 1, 2023

lore
Share & tools
lore
#0 lore raw

cover xen: address violations of MISRA C:2012 Rule 8.2

This patch series adds some of the missing parameter names. No functional changes are introduced.

Federico Serafini (11):
xen/console: address violations of MISRA C:2012 Rule 8.2 xen/aclinux: address violations of MISRA C:2012 Rule 8.2 xen/cpumask: address violations of MISRA C:2012 Rule 8.2 xen/dmi: address a violation of MISRA C:2012 Rule 8.2 xen/domain: address violations of MISRA C:2012 Rule 8.2 xen/notifier: address violations of MISRA C:2012 Rule 8.2 xen/iommu: address violations of MISRA C:2012 Rule 8.2 xen/kernel: address a violation of MISRA C:2012 Rule 8.2 xen/param: address a violation of MISRA C:2012 Rule 8.2 xen/perfc: address a violation of MISRA C:2012 Rule 8.2 xen/serial: address a violation of MISRA C:2012 Rule 8.2

 xen/drivers/char/console.c          |  4 ++--
 xen/include/acpi/platform/aclinux.h |  6 +++---
 xen/include/xen/console.h           |  2 +-
 xen/include/xen/cpumask.h           |  6 ++++--
 xen/include/xen/dmi.h               |  2 +-
 xen/include/xen/domain.h            | 14 +++++++-------
 xen/include/xen/iommu.h             | 13 +++++++------
 xen/include/xen/kernel.h            |  2 +-
 xen/include/xen/notifier.h          |  3 ++-
 xen/include/xen/param.h             |  2 +-
 xen/include/xen/perfc.h             |  2 +-
 xen/include/xen/serial.h            |  2 +-
 12 files changed, 31 insertions(+), 27 deletions(-)
Signature · 1 line
2.34.1
#17 lore raw

PATCH 8/11 xen/kernel: address a violation of MISRA C:2012 Rule 8.2

Add missing parameter name. No functional change.

---
 xen/include/xen/kernel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/kernel.h +1 -1
index 560b1c2832..6bbd4a2827 100644
@@ -112,7 +112,7 @@ struct vcpu;
 
 void show_execution_state(const struct cpu_user_regs *regs);
 void cf_check show_execution_state_nonconst(struct cpu_user_regs *regs);
-void vcpu_show_execution_state(struct vcpu *);
+void vcpu_show_execution_state(struct vcpu *v);
 
 #endif /* _LINUX_KERNEL_H */
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/11 xen/aclinux: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/include/acpi/platform/aclinux.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/include/acpi/platform/aclinux.h +3 -3
index 9e572460dc..f5e0a6108e 100644
@@ -75,9 +75,9 @@
 
 #define acpi_thread_id struct vcpu *
 
-void *acpi_os_alloc_memory(size_t);
-void *acpi_os_zalloc_memory(size_t);
-void acpi_os_free_memory(void *);
+void *acpi_os_alloc_memory(size_t sz);
+void *acpi_os_zalloc_memory(size_t sz);
+void acpi_os_free_memory(void *ptr);
 
 #define ACPI_ALLOCATE(a)	acpi_os_alloc_memory(a)
 #define ACPI_ALLOCATE_ZEROED(a)	acpi_os_zalloc_memory(a)
Signature · 1 line
2.34.1
#7 lore raw

PATCH 4/11 xen/dmi: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/include/xen/dmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/dmi.h +1 -1
index 71a5c46dc6..0fef41842e 100644
@@ -24,7 +24,7 @@ struct dmi_strmatch {
 };
 
 struct dmi_system_id {
-	int (*callback)(const struct dmi_system_id *);
+	int (*callback)(const struct dmi_system_id *d);
 	const char *ident;
 	struct dmi_strmatch matches[4];
 	void *driver_data;
Signature · 1 line
2.34.1
#23 lore raw

PATCH 10/11 xen/perfc: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/include/xen/perfc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/perfc.h +1 -1
index 96022c0748..f9009dc388 100644
@@ -94,7 +94,7 @@ DECLARE_PER_CPU(perfc_t[NUM_PERFCOUNTERS], perfcounters);
 #endif
 
 struct xen_sysctl_perfc_op;
-int perfc_control(struct xen_sysctl_perfc_op *);
+int perfc_control(struct xen_sysctl_perfc_op *pc);
 
 extern void cf_check perfc_printall(unsigned char key);
 extern void cf_check perfc_reset(unsigned char key);
Signature · 1 line
2.34.1
#12 lore raw

PATCH 6/11 xen/notifier: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/include/xen/notifier.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/include/xen/notifier.h +2 -1
index 51453c1552..2a952484df 100644
@@ -23,7 +23,8 @@
  */
 
 struct notifier_block {
-    int (*notifier_call)(struct notifier_block *, unsigned long, void *);
+    int (*notifier_call)(struct notifier_block *nfb, unsigned long action,
+                         void *hcpu);
     struct list_head chain;
     int priority;
 };
Signature · 1 line
2.34.1
#9 lore raw

PATCH 5/11 xen/domain: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/include/xen/domain.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
xen/include/xen/domain.h +7 -7
index 460c8c3d27..d345278b71 100644
@@ -25,7 +25,7 @@ unsigned int dom0_max_vcpus(void);
 int parse_arch_dom0_param(const char *s, const char *e);
 struct vcpu *alloc_dom0_vcpu0(struct domain *dom0);
 
-int vcpu_reset(struct vcpu *);
+int vcpu_reset(struct vcpu *v);
 int vcpu_up(struct vcpu *v);
 
 void setup_system_domains(void);
@@ -65,9 +65,9 @@ void free_vcpu_struct(struct vcpu *v);
 
 /* Allocate/free a PIRQ structure. */
 #ifndef alloc_pirq_struct
-struct pirq *alloc_pirq_struct(struct domain *);
+struct pirq *alloc_pirq_struct(struct domain *d);
 #endif
-void cf_check free_pirq_struct(void *);
+void cf_check free_pirq_struct(void *ptr);
 
 /*
  * Initialise/destroy arch-specific details of a VCPU.
@@ -103,8 +103,8 @@ void arch_domain_creation_finished(struct domain *d);
 
 void arch_p2m_set_access_required(struct domain *d, bool access_required);
 
-int arch_set_info_guest(struct vcpu *, vcpu_guest_context_u);
-void arch_get_info_guest(struct vcpu *, vcpu_guest_context_u);
+int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c);
+void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c);
 
 int arch_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
 int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
@@ -112,7 +112,7 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
 int arch_get_paging_mempool_size(struct domain *d, uint64_t *size /* bytes */);
 int arch_set_paging_mempool_size(struct domain *d, uint64_t size /* bytes */);
 
-bool update_runstate_area(struct vcpu *);
+bool update_runstate_area(struct vcpu *v);
 
 int domain_relinquish_resources(struct domain *d);
 
@@ -122,7 +122,7 @@ void arch_dump_vcpu_info(struct vcpu *v);
 
 void arch_dump_domain_info(struct domain *d);
 
-int arch_vcpu_reset(struct vcpu *);
+int arch_vcpu_reset(struct vcpu *v);
 
 bool domctl_lock_acquire(void);
 void domctl_lock_release(void);
Signature · 1 line
2.34.1
#20 lore raw

PATCH 9/11 xen/param: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/include/xen/param.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/param.h +1 -1
index 93c3fe7cb7..9170455cde 100644
@@ -22,7 +22,7 @@ struct kernel_param {
     unsigned int len;
     union {
         void *var;
-        int (*func)(const char *);
+        int (*func)(const char *s);
     } par;
 };
 
Signature · 1 line
2.34.1
#15 lore raw

PATCH 7/11 xen/iommu: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names to address violations of MISRA C:2012 Rule 8.2 and remove uses of u{8,16,32} in favor of C standard types. No functional change.

---
 xen/include/xen/iommu.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
xen/include/xen/iommu.h +7 -6
index d5c2577091..69d572543c 100644
@@ -262,14 +262,15 @@ struct iommu_ops {
     int (*init)(struct domain *d);
     void (*hwdom_init)(struct domain *d);
     int (*quarantine_init)(device_t *dev, bool scratch_page);
-    int (*add_device)(u8 devfn, device_t *dev);
+    int (*add_device)(uint8_t devfn, device_t *dev);
     int (*enable_device)(device_t *dev);
-    int (*remove_device)(u8 devfn, device_t *dev);
-    int (*assign_device)(struct domain *, u8 devfn, device_t *dev, u32 flag);
+    int (*remove_device)(uint8_t devfn, device_t *dev);
+    int (*assign_device)(struct domain *d, uint8_t devfn, device_t *dev,
+                         uint32_t flag);
     int (*reassign_device)(struct domain *s, struct domain *t,
-                           u8 devfn, device_t *dev);
+                           uint8_t devfn, device_t *dev);
 #ifdef CONFIG_HAS_PCI
-    int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
+    int (*get_device_group_id)(uint16_t seg, uint8_t bus, uint8_t devfn);
 #endif /* HAS_PCI */
 
     void (*teardown)(struct domain *d);
@@ -308,7 +309,7 @@ struct iommu_ops {
     int __must_check (*iotlb_flush)(struct domain *d, dfn_t dfn,
                                     unsigned long page_count,
                                     unsigned int flush_flags);
-    int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
+    int (*get_reserved_device_memory)(iommu_grdm_t *func, void *ctxt);
     void (*dump_page_tables)(struct domain *d);
 
 #ifdef CONFIG_HAS_DEVICE_TREE
Signature · 1 line
2.34.1
#26 lore raw

PATCH 11/11 xen/serial: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
In my previous patch for serial.h I missed one parameter: sorry for that.

---
 xen/include/xen/serial.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/serial.h +1 -1
index 8d64fb5e86..870ca2f6eb 100644
@@ -181,7 +181,7 @@ static void inline xhci_dbc_uart_init(void) {};
 void arm_uart_init(void);
 
 struct physdev_dbgp_op;
-int dbgp_op(const struct physdev_dbgp_op *);
+int dbgp_op(const struct physdev_dbgp_op *op);
 
 /* Baud rate was pre-configured before invoking the UART driver. */
 #define BAUD_AUTO (-1)
Signature · 1 line
2.34.1
#5 lore raw

PATCH 3/11 xen/cpumask: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/include/xen/cpumask.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/cpumask.h +4 -2
index 9826707909..145e140481 100644
@@ -460,7 +460,9 @@ extern cpumask_t cpu_present_map;
 
 /* Copy to/from cpumap provided by control tools. */
 struct xenctl_bitmap;
-int cpumask_to_xenctl_bitmap(struct xenctl_bitmap *, const cpumask_t *);
-int xenctl_bitmap_to_cpumask(cpumask_var_t *, const struct xenctl_bitmap *);
+int cpumask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_cpumap,
+                             const cpumask_t *cpumask);
+int xenctl_bitmap_to_cpumask(cpumask_var_t *cpumask,
+                             const struct xenctl_bitmap *xenctl_cpumap);
 
 #endif /* __XEN_CPUMASK_H */
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/11 xen/console: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/drivers/char/console.c | 4 ++--
 xen/include/xen/console.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
xen/drivers/char/console.c +2 -2
index 946af5e625..0666564ec9 100644
@@ -393,9 +393,9 @@ long read_console_ring(struct xen_sysctl_readconsole *op)
 static char serial_rx_ring[SERIAL_RX_SIZE];
 static unsigned int serial_rx_cons, serial_rx_prod;
 
-static void (*serial_steal_fn)(const char *, size_t nr) = early_puts;
+static void (*serial_steal_fn)(const char *str, size_t nr) = early_puts;
 
-int console_steal(int handle, void (*fn)(const char *, size_t nr))
+int console_steal(int handle, void (*fn)(const char *str, size_t nr))
 {
     if ( (handle == -1) || (handle != sercon_handle) )
         return 0;
xen/include/xen/console.h +1 -1
index ab5c30c0da..68759862e8 100644
@@ -36,7 +36,7 @@ struct domain *console_input_domain(void);
  * Steal output from the console. Returns +ve identifier, else -ve error.
  * Takes the handle of the serial line to steal, and steal callback function.
  */
-int console_steal(int handle, void (*fn)(const char *, size_t nr));
+int console_steal(int handle, void (*fn)(const char *str, size_t nr));
 
 /* Give back stolen console. Takes the identifier returned by console_steal. */
 void console_giveback(int id);
Signature · 1 line
2.34.1
Acked-by on v1 3/11
#6 lore raw

Re: [XEN PATCH 03/11] xen/cpumask: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini
Quoted 3 lines · Federico Serafini

Add missing parameter names. No functional change.

irrespective of this being one of the examples where types alone are entirely sufficient and descriptive.

Jan

Quoted 14 lines
xen/include/xen/cpumask.h +4 -2
@@ -460,7 +460,9 @@ extern cpumask_t cpu_present_map;
 
 /* Copy to/from cpumap provided by control tools. */
 struct xenctl_bitmap;
-int cpumask_to_xenctl_bitmap(struct xenctl_bitmap *, const cpumask_t *);
-int xenctl_bitmap_to_cpumask(cpumask_var_t *, const struct xenctl_bitmap *);
+int cpumask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_cpumap,
+                             const cpumask_t *cpumask);
+int xenctl_bitmap_to_cpumask(cpumask_var_t *cpumask,
+                             const struct xenctl_bitmap *xenctl_cpumap);
 
 #endif /* __XEN_CPUMASK_H */
Acked-by on v1 9/11
#21 lore raw

Re: [XEN PATCH 09/11] xen/param: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini
Quoted 3 lines · Federico Serafini

Add missing parameter name. No functional change.

xen/include/xen/param.h struct kernel_param { · line 25

Quoted 8 lines
xen/include/xen/param.h +1 -1
@@ -22,7 +22,7 @@ struct kernel_param {
     unsigned int len;
     union {
         void *var;
-        int (*func)(const char *);
+        int (*func)(const char *s);

Still I again wonder what good this name does us here.

Jan