From nobody Sun Feb 8 23:34:58 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CDEE41B37B for ; Wed, 4 Feb 2026 14:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216957; cv=none; b=LkAfYiWkbJS6zIAm9FgL0F+jeGsJSbMLpWHoDYlQuSLfvGdY/p8Hm9vMrA2yI5Ng/NvsD18c0y1tHWYT6TECqHIWSwisZkqOKXE8+38rurdmXUO48Nrjzvny7h813cQoZ39qRgCjZchJ8lJ6OEXm//vXn5yzQvuEiS71CDShw44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216957; c=relaxed/simple; bh=aqVw+KwudE2PMyQ5c7D0mNKToCJ+MFm+4+/iUzlVPSg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eCTIVrbHW7/RqWCpO4knRzn3K9d/dYxt9mvHvmB2xcBQFQKJo3Z6rrEHSb0oDEVYxTwDIEgzRgqDm2+otNsqV1jcJRFGZV4kONTe6xsLNW0GBwQQX0M8i7GLOvQqmsUzApiYyn48F9tJp3Z203ZRoNZy5qsBTr0IdPc7ZvPIsSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HtRwoQ77; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HtRwoQ77" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770216956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i4PzDDOnMDtmDhq8eE10nYEtt4SKmr4xmRLUOnegfHQ=; b=HtRwoQ77WcQg+rl/1zgXd94ZNETwnoYwqYwS3puMfF5GekJGJ/NsxYUP9mjLwWdGQ9dLjb 5Od/2V0zvkE+HLoeDuGP9XQibXynqR/tAsz38QamX3SSn00aLD7fhnvZUSpq5AZHFUSYg4 13hYBKpoG8JjxBPF6+UkvmdIAD7eHKM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-vyQApY_iPmC5BsT3-3wMQQ-1; Wed, 04 Feb 2026 09:55:55 -0500 X-MC-Unique: vyQApY_iPmC5BsT3-3wMQQ-1 X-Mimecast-MFC-AGG-ID: vyQApY_iPmC5BsT3-3wMQQ_1770216954 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC60E180063A; Wed, 4 Feb 2026 14:55:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.88.140]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 746A530001A5; Wed, 4 Feb 2026 14:55:51 +0000 (UTC) From: Wander Lairson Costa To: Steven Rostedt , Gabriele Monaco , Nam Cao , Wander Lairson Costa , linux-trace-kernel@vger.kernel.org (open list:RUNTIME VERIFICATION (RV)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 18/20] rv/rvgen: fix unbound loop variable warning Date: Wed, 4 Feb 2026 11:42:44 -0300 Message-ID: <20260204144914.104028-19-wander@redhat.com> In-Reply-To: <20260204144914.104028-1-wander@redhat.com> References: <20260204144914.104028-1-wander@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Pyright static analysis reports a "possibly unbound variable" warning for the loop variable `i` in the `abbreviate_atoms` function. The variable is accessed after the inner loop terminates to slice the atom string. While the loop logic currently ensures execution, the analyzer flags the reliance on the loop variable persisting outside its scope. Refactor the prefix length calculation into a nested `find_share_length` helper function. This encapsulates the search logic and uses explicit return statements, ensuring the length value is strictly defined. This satisfies the type checker and improves code readability without altering the runtime behavior. Signed-off-by: Wander Lairson Costa Reviewed-by: Gabriele Monaco --- tools/verification/rvgen/rvgen/ltl2k.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/verification/rvgen/rvgen/ltl2k.py b/tools/verification/r= vgen/rvgen/ltl2k.py index fa9ea6d597095..2c564cc937235 100644 --- a/tools/verification/rvgen/rvgen/ltl2k.py +++ b/tools/verification/rvgen/rvgen/ltl2k.py @@ -43,13 +43,17 @@ def abbreviate_atoms(atoms: list[str]) -> list[str]: skip =3D ["is", "by", "or", "and"] return '_'.join([x[:2] for x in s.lower().split('_') if x not in s= kip]) =20 - abbrs =3D [] - for atom in atoms: + def find_share_length(atom: str) -> int: for i in range(len(atom), -1, -1): if sum(a.startswith(atom[:i]) for a in atoms) > 1: - break - share =3D atom[:i] - unique =3D atom[i:] + return i + return 0 + + abbrs =3D [] + for atom in atoms: + share_len =3D find_share_length(atom) + share =3D atom[:share_len] + unique =3D atom[share_len:] abbrs.append((shorten(share) + shorten(unique))) return abbrs =20 --=20 2.52.0