[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <613427efef5c10cf04920ae16f0380b64e580241.camel@redhat.com>
Date: Thu, 05 Feb 2026 12:44:33 +0100
From: Gabriele Monaco <gmonaco@...hat.com>
To: Wander Lairson Costa <wander@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, Nam Cao <namcao@...utronix.de>,
"open list:RUNTIME VERIFICATION (RV)"
<linux-trace-kernel@...r.kernel.org>, open list
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 17/20] rv/rvgen: enforce presence of initial state
On Wed, 2026-02-04 at 11:42 -0300, Wander Lairson Costa wrote:
> The __get_state_variables() method parses DOT files to identify the
> automaton's initial state. If the input file lacks a node with the
> required initialization prefix, the initial_state variable is referenced
> before assignment, causing an UnboundLocalError or a generic error
> during the state removal step.
>
> Initialize the variable explicitly and validate that a start node was
> found after parsing. Raise a descriptive AutomataError if the definition
> is missing to improve debugging and ensure the automaton is valid.
>
> Signed-off-by: Wander Lairson Costa <wander@...hat.com>
Reviewed-by: Gabriele Monaco <gmonaco@...hat.com>
> ---
> tools/verification/rvgen/rvgen/automata.py | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/verification/rvgen/rvgen/automata.py
> b/tools/verification/rvgen/rvgen/automata.py
> index 270a3d0bf4ce7..cf82f04dbc661 100644
> --- a/tools/verification/rvgen/rvgen/automata.py
> +++ b/tools/verification/rvgen/rvgen/automata.py
> @@ -105,6 +105,7 @@ class Automata:
> # wait for node declaration
> states = []
> final_states = []
> + initial_state = ""
>
> has_final_states = False
> cursor = self.__get_cursor_begin_states()
> @@ -131,6 +132,9 @@ class Automata:
> final_states.append(state)
> has_final_states = True
>
> + if not initial_state:
> + raise AutomataError("The automaton doesn't have an initial
> state")
> +
> states = sorted(set(states))
> states.remove(initial_state)
>
Powered by blists - more mailing lists