* [PATCH 0/4] Misc MISRA fixes for default Xen build configurations
@ 2025-11-20 19:32 Nicola Vetrini
2025-11-20 19:32 ` [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2 Nicola Vetrini
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Nicola Vetrini @ 2025-11-20 19:32 UTC (permalink / raw)
To: xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Nicola Vetrini,
Daniel P. Smith, Dario Faggioli, Juergen Gross, George Dunlap,
Anthony PERARD, Michal Orzel, Julien Grall, Roger Pau Monné
This series addresses some of the violations found by widening the scope of
application of MISRA checking to default builds of Xen for both ARM64 and x86_64.
While it has been tested on top of a patch yet to be applied (but with
the necessary R-by [1]) these fixes can go in independently of that.
As evidenced by the CI pipeline below, there are a number of regressions on
guidelines that were clean on the restricted scope but are not in the wider one;
the patches in this series address a subset of those.
CI pipeline: https://gitlab.com/xen-project/people/bugseng/xen/-/pipelines/2156782159
[1] https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2511031448530.495094@ubuntu-linux-20-04-desktop/
Nicola Vetrini (4):
xen/xsm: address violations of MISRA C rules 8.3 and 7.2
xen/sched: address violation of MISRA C Rule 16.3
xen/param: address violation of MISRA C Rule 20.7
xen/param: address violation of MISRA C Rule 8.2
xen/common/sched/credit.c | 2 +-
xen/include/xen/param.h | 6 +++---
xen/include/xsm/xsm.h | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
--
2.51.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2
2025-11-20 19:32 [PATCH 0/4] Misc MISRA fixes for default Xen build configurations Nicola Vetrini
@ 2025-11-20 19:32 ` Nicola Vetrini
2025-11-25 14:52 ` Daniel P. Smith
2025-11-20 19:32 ` [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3 Nicola Vetrini
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Nicola Vetrini @ 2025-11-20 19:32 UTC (permalink / raw)
To: xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Nicola Vetrini,
Daniel P. Smith
Rule 8.3 states: Function types shall be in prototype form
with named parameters.
add parameter to 'has_xsm_magic' to make it consistent with the
definition.
Rule 7.2 states: A `u' or `U' suffix shall be applied to all
integer constants that are represented in an unsigned type.
add missing `U' to both #define for `XSM_MAGIC` for consistency.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
---
xen/include/xsm/xsm.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 9a23d2827c..074d61cd45 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -22,9 +22,9 @@
typedef uint32_t xsm_magic_t;
#ifdef CONFIG_XSM_FLASK
-#define XSM_MAGIC 0xf97cff8c
+#define XSM_MAGIC 0xf97cff8cU
#else
-#define XSM_MAGIC 0x0
+#define XSM_MAGIC 0x0U
#endif
/*
@@ -815,7 +815,7 @@ int xsm_multiboot_policy_init(
*/
int xsm_dt_init(void);
int xsm_dt_policy_init(void **policy_buffer, size_t *policy_size);
-bool has_xsm_magic(paddr_t);
+bool has_xsm_magic(paddr_t start);
#endif
void xsm_fixup_ops(struct xsm_ops *ops);
--
2.51.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3
2025-11-20 19:32 [PATCH 0/4] Misc MISRA fixes for default Xen build configurations Nicola Vetrini
2025-11-20 19:32 ` [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2 Nicola Vetrini
@ 2025-11-20 19:32 ` Nicola Vetrini
2025-11-24 10:27 ` Jürgen Groß
2025-11-20 19:32 ` [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7 Nicola Vetrini
2025-11-20 19:32 ` [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2 Nicola Vetrini
3 siblings, 1 reply; 9+ messages in thread
From: Nicola Vetrini @ 2025-11-20 19:32 UTC (permalink / raw)
To: xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Nicola Vetrini,
Dario Faggioli, Juergen Gross, George Dunlap
The rule states: An unconditional `break' statement shall terminate
every switch-clause.
Use the `fallthrough' pseudo-keyword for which an ECLAIR deviation
is already in place.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
---
xen/common/sched/credit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c
index 6dcf6b2c8b..e9a91d11c3 100644
--- a/xen/common/sched/credit.c
+++ b/xen/common/sched/credit.c
@@ -1288,7 +1288,7 @@ csched_sys_cntl(const struct scheduler *ops,
prv->unit_migr_delay = MICROSECS(params->vcpu_migr_delay_us);
spin_unlock_irqrestore(&prv->lock, flags);
- /* FALLTHRU */
+ fallthrough;
case XEN_SYSCTL_SCHEDOP_getinfo:
params->tslice_ms = prv->tslice / MILLISECS(1);
params->ratelimit_us = prv->ratelimit / MICROSECS(1);
--
2.51.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7
2025-11-20 19:32 [PATCH 0/4] Misc MISRA fixes for default Xen build configurations Nicola Vetrini
2025-11-20 19:32 ` [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2 Nicola Vetrini
2025-11-20 19:32 ` [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3 Nicola Vetrini
@ 2025-11-20 19:32 ` Nicola Vetrini
2025-11-24 12:58 ` Jan Beulich
2025-11-20 19:32 ` [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2 Nicola Vetrini
3 siblings, 1 reply; 9+ messages in thread
From: Nicola Vetrini @ 2025-11-20 19:32 UTC (permalink / raw)
To: xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Nicola Vetrini,
Anthony PERARD, Michal Orzel, Julien Grall, Roger Pau Monné
The rule states: Expressions resulting from the expansion of
macro parameters shall be enclosed in parentheses.
Add parentheses in the defition of `custom_runtime_var_sz' to
address the violations.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
---
xen/include/xen/param.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h
index 1bdbab34ab..f5a2189400 100644
--- a/xen/include/xen/param.h
+++ b/xen/include/xen/param.h
@@ -102,8 +102,8 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
#define custom_runtime_set_var_sz(parfs, var, sz) \
{ \
- (parfs)->hypfs.u.content = var; \
- (parfs)->hypfs.e.max_size = sz; \
+ (parfs)->hypfs.u.content = (var); \
+ (parfs)->hypfs.e.max_size = (sz); \
(parfs)->hypfs.e.size = strlen(var) + 1; \
}
#define custom_runtime_set_var(parfs, var) \
--
2.51.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2
2025-11-20 19:32 [PATCH 0/4] Misc MISRA fixes for default Xen build configurations Nicola Vetrini
` (2 preceding siblings ...)
2025-11-20 19:32 ` [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7 Nicola Vetrini
@ 2025-11-20 19:32 ` Nicola Vetrini
2025-11-24 12:59 ` Jan Beulich
3 siblings, 1 reply; 9+ messages in thread
From: Nicola Vetrini @ 2025-11-20 19:32 UTC (permalink / raw)
To: xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Nicola Vetrini,
Anthony PERARD, Michal Orzel, Julien Grall, Roger Pau Monné
add missing parameter name in function pointer member declaration.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
---
xen/include/xen/param.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h
index f5a2189400..3b6f134b07 100644
--- a/xen/include/xen/param.h
+++ b/xen/include/xen/param.h
@@ -90,7 +90,7 @@ extern const struct kernel_param __setup_start[], __setup_end[];
struct param_hypfs {
struct hypfs_entry_leaf hypfs;
void (*init_leaf)(struct param_hypfs *par);
- int (*func)(const char *);
+ int (*func)(const char *s);
};
extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
--
2.51.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3
2025-11-20 19:32 ` [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3 Nicola Vetrini
@ 2025-11-24 10:27 ` Jürgen Groß
0 siblings, 0 replies; 9+ messages in thread
From: Jürgen Groß @ 2025-11-24 10:27 UTC (permalink / raw)
To: Nicola Vetrini, xen-devel
Cc: andrew.cooper3, jbeulich, sstabellini, Dario Faggioli,
George Dunlap
[-- Attachment #1.1.1: Type: text/plain, Size: 386 bytes --]
On 20.11.25 20:32, Nicola Vetrini wrote:
> The rule states: An unconditional `break' statement shall terminate
> every switch-clause.
>
> Use the `fallthrough' pseudo-keyword for which an ECLAIR deviation
> is already in place.
>
> No functional change.
>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7
2025-11-20 19:32 ` [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7 Nicola Vetrini
@ 2025-11-24 12:58 ` Jan Beulich
0 siblings, 0 replies; 9+ messages in thread
From: Jan Beulich @ 2025-11-24 12:58 UTC (permalink / raw)
To: Nicola Vetrini
Cc: andrew.cooper3, sstabellini, Anthony PERARD, Michal Orzel,
Julien Grall, Roger Pau Monné, xen-devel
On 20.11.2025 20:32, Nicola Vetrini wrote:
> The rule states: Expressions resulting from the expansion of
> macro parameters shall be enclosed in parentheses.
>
> Add parentheses in the defition of `custom_runtime_var_sz' to
> address the violations.
>
> No functional change.
>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2
2025-11-20 19:32 ` [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2 Nicola Vetrini
@ 2025-11-24 12:59 ` Jan Beulich
0 siblings, 0 replies; 9+ messages in thread
From: Jan Beulich @ 2025-11-24 12:59 UTC (permalink / raw)
To: Nicola Vetrini
Cc: andrew.cooper3, sstabellini, Anthony PERARD, Michal Orzel,
Julien Grall, Roger Pau Monné, xen-devel
On 20.11.2025 20:32, Nicola Vetrini wrote:
> add missing parameter name in function pointer member declaration.
>
> No functional change.
>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2
2025-11-20 19:32 ` [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2 Nicola Vetrini
@ 2025-11-25 14:52 ` Daniel P. Smith
0 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Smith @ 2025-11-25 14:52 UTC (permalink / raw)
To: Nicola Vetrini, xen-devel; +Cc: andrew.cooper3, jbeulich, sstabellini
On 11/20/25 2:32 PM, Nicola Vetrini wrote:
> Rule 8.3 states: Function types shall be in prototype form
> with named parameters.
>
> add parameter to 'has_xsm_magic' to make it consistent with the
> definition.
>
> Rule 7.2 states: A `u' or `U' suffix shall be applied to all
> integer constants that are represented in an unsigned type.
>
> add missing `U' to both #define for `XSM_MAGIC` for consistency.
>
> No functional change.
>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
> ---
> xen/include/xsm/xsm.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
> index 9a23d2827c..074d61cd45 100644
> --- a/xen/include/xsm/xsm.h
> +++ b/xen/include/xsm/xsm.h
> @@ -22,9 +22,9 @@
> typedef uint32_t xsm_magic_t;
>
> #ifdef CONFIG_XSM_FLASK
> -#define XSM_MAGIC 0xf97cff8c
> +#define XSM_MAGIC 0xf97cff8cU
> #else
> -#define XSM_MAGIC 0x0
> +#define XSM_MAGIC 0x0U
> #endif
>
> /*
> @@ -815,7 +815,7 @@ int xsm_multiboot_policy_init(
> */
> int xsm_dt_init(void);
> int xsm_dt_policy_init(void **policy_buffer, size_t *policy_size);
> -bool has_xsm_magic(paddr_t);
> +bool has_xsm_magic(paddr_t start);
> #endif
>
> void xsm_fixup_ops(struct xsm_ops *ops);
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-25 14:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 19:32 [PATCH 0/4] Misc MISRA fixes for default Xen build configurations Nicola Vetrini
2025-11-20 19:32 ` [PATCH 1/4] xen/xsm: address violations of MISRA C rules 8.3 and 7.2 Nicola Vetrini
2025-11-25 14:52 ` Daniel P. Smith
2025-11-20 19:32 ` [PATCH 2/4] xen/sched: address violation of MISRA C Rule 16.3 Nicola Vetrini
2025-11-24 10:27 ` Jürgen Groß
2025-11-20 19:32 ` [PATCH 3/4] xen/param: address violation of MISRA C Rule 20.7 Nicola Vetrini
2025-11-24 12:58 ` Jan Beulich
2025-11-20 19:32 ` [PATCH 4/4] xen/param: address violation of MISRA C Rule 8.2 Nicola Vetrini
2025-11-24 12:59 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.