From: Wander Lairson Costa Date: Mon, 23 Feb 2026 16:17:52 +0000 (-0300) Subject: rv/rvgen: fix DOT file validation logic error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d5a7d88185bc7c99328a29498efb3154e2d23d7;p=thirdparty%2Fkernel%2Flinux.git rv/rvgen: fix DOT file validation logic error Fix incorrect boolean logic in automata DOT file format validation that allowed malformed files to pass undetected. The previous implementation used a logical AND operator where OR was required, causing the validation to only reject files when both the first token was not "digraph" AND the second token was not "state_automaton". This meant a file starting with "digraph" but having an incorrect second token would incorrectly pass validation. The corrected logic properly rejects DOT files where either the first token is not "digraph" or the second token is not "state_automaton", ensuring that only properly formatted automaton definition files are accepted for processing. Without this fix, invalid DOT files could cause downstream parsing failures or generate incorrect C code for runtime verification monitors. Signed-off-by: Wander Lairson Costa Reviewed-by: Nam Cao Reviewed-by: Gabriele Monaco Link: https://lore.kernel.org/r/20260223162407.147003-10-wander@redhat.com Signed-off-by: Gabriele Monaco --- diff --git a/tools/verification/rvgen/rvgen/automata.py b/tools/verification/rvgen/rvgen/automata.py index 397f236e6eea3..6b0dc1a8cd6a1 100644 --- a/tools/verification/rvgen/rvgen/automata.py +++ b/tools/verification/rvgen/rvgen/automata.py @@ -99,7 +99,7 @@ class Automata: # checking the first line: line = dot_lines[cursor].split() - if (line[0] != "digraph") and (line[1] != "state_automaton"): + if (line[0] != "digraph") or (line[1] != "state_automaton"): raise AutomataError(f"Not a valid .dot format: {self.__dot_path}") else: cursor += 1