From nobody Mon Feb 9 00:42:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 57A0A37BE94; Thu, 29 Jan 2026 08:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769674111; cv=none; b=Mx9NLK2nIiDlNEkOnowq9P+DjZc1PmtE0G34u4d8keg4efCSED/AeWaVoMAKSD60ENQ24mTiAVU7g9qykE95eE4IeNtYNwXoCjGjDwkrNrFvEPbWbJW/D1jrsGxUPwPExGkf7eWz1akMLsp48jnzm17ssbZQwMjcB8E1uW59jxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769674111; c=relaxed/simple; bh=LaLUXoY/KS6WIRVp9iorgFncFjJ1rGpIWKLw4YbQxJU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UXt5TrbD1X57TJxKIbwASpxxp5o6RDFFGisNRBE1a/+NIi8EOT54Wl5k/uZ6Rx8koBTDBsYntV7uaWzVLjj25KyDBqt205XZ70eCIPKt9F1jwvR6e/heiVDnpxV/xcY4eGXnUjlyQ7uq7/czzZmInIl4lCy4mZFlyHE14eHlTAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iWvhwl1b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iWvhwl1b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5893C2BCB8; Thu, 29 Jan 2026 08:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769674110; bh=LaLUXoY/KS6WIRVp9iorgFncFjJ1rGpIWKLw4YbQxJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWvhwl1bfp2HBezorxauaO2EZmjPRMrkGOxSaekiDDkwvvj54BDshhDG+O7SVaA9C xdaxITXkK+MopAflWPI8De6K5bYS2ZxkJPqKMhFpSdRY/ZO2kYVYG9qIT0LrLz6/C1 svr53IqwZasCzcupbxTQhw8NWrQB2XViEOusMQch1adrBJUYq8Fp9hJNfSsWXCk1rG Q32rJBkRJegIt7DWiF+o1vjrt8lAmuOPrNT/kFCF4QyaMf0L1znAQPcqbY0Dpn20HY X4X+C+bpDUwRK8KLSikyO01ou2ABIiQr2he1mSqkdruUDwB3fnUJYzD/1R1M/ZNZsr GpTw9EisEz9rw== Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vlN4n-0000000ERNV-0IyM; Thu, 29 Jan 2026 09:08:29 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH v3 15/30] docs: kdoc_re: properly handle strings and escape chars on it Date: Thu, 29 Jan 2026 09:08:06 +0100 Message-ID: <486ef8c6f1f066d495b23df2dcd450fa5c2bc3e7.1769673038.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab The logic inside NestedMatch currently doesn't consider that function arguments may have chars and strings, which may eventually contain delimiters. Add logic to handle strings and escape characters on them. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Aleksandr Loktionov --- tools/lib/python/kdoc/kdoc_re.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/lib/python/kdoc/kdoc_re.py b/tools/lib/python/kdoc/kdoc_= re.py index a0402c065d3a..1861799f1966 100644 --- a/tools/lib/python/kdoc/kdoc_re.py +++ b/tools/lib/python/kdoc/kdoc_re.py @@ -195,6 +195,8 @@ class NestedMatch: for match_re in regex.finditer(line): start =3D match_re.start() offset =3D match_re.end() + string_char =3D None + escape =3D False =20 d =3D line[offset - 1] if d not in self.DELIMITER_PAIRS: @@ -208,6 +210,22 @@ class NestedMatch: =20 d =3D line[pos] =20 + if escape: + escape =3D False + continue + + if string_char: + if d =3D=3D '\\': + escape =3D True + elif d =3D=3D string_char: + string_char =3D None + + continue + + if d in ('"', "'"): + string_char =3D d + continue + if d in self.DELIMITER_PAIRS: end =3D self.DELIMITER_PAIRS[d] =20 --=20 2.52.0