Re: [PATCH] rv/monitors: Move monitor structure in rodata

From: Daniel Bristot de Oliveira
Date: Tue Nov 22 2022 - 09:13:35 EST


On 11/18/22 17:20, Alessandro Carminati wrote:
> It makes sense to move the important monitor structure into rodata to
> prevent accidental structure modification.
>
> Signed-off-by: Alessandro Carminati <acarmina@xxxxxxxxxx>
> ---
> kernel/trace/rv/monitors/wip/wip.h | 2 +-
> kernel/trace/rv/monitors/wwnr/wwnr.h | 2 +-
> tools/verification/dot2/dot2c.py | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/rv/monitors/wip/wip.h b/kernel/trace/rv/monitors/wip/wip.h
> index dacc37b62a2c..9c0cd0ad5cd7 100644
> --- a/kernel/trace/rv/monitors/wip/wip.h
> +++ b/kernel/trace/rv/monitors/wip/wip.h
> @@ -27,7 +27,7 @@ struct automaton_wip {
> bool final_states[state_max_wip];
> };
>
> -static struct automaton_wip automaton_wip = {
> +const static struct automaton_wip automaton_wip = {
> .state_names = {
> "preemptive",
> "non_preemptive"
> diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.h b/kernel/trace/rv/monitors/wwnr/wwnr.h

checkpatch says:

WARNING: Move const after static - use 'static const struct automaton_wip '
#32: FILE: kernel/trace/rv/monitors/wip/wip.h:30:
+const static struct automaton_wip automaton_wip = {

WARNING: Move const after static - use 'static const struct automaton_wwnr '
#45: FILE: kernel/trace/rv/monitors/wwnr/wwnr.h:30:
+const static struct automaton_wwnr automaton_wwnr = {

and this is also true for the dot2c part.

Do you mind fixing that in a v2?

-- Daniel