From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-hardening@vger.kernel.org, peter.griffin@linaro.org,
andre.draszik@linaro.org, willmcvicker@google.com,
jyescas@google.com, krzk@kernel.org, kernel-team@android.com
Subject: Re: [PATCH] docs: kernel-doc: python: strip __counted_by_ptr macro
Date: Tue, 12 May 2026 08:20:03 +0200 [thread overview]
Message-ID: <20260512082003.4b36bdaf@foz.lan> (raw)
In-Reply-To: <20260506-kdoc-__counted_by_ptr-v1-1-70763486871f@linaro.org>
On Wed, 06 May 2026 11:04:12 +0000
Tudor Ambarus <tudor.ambarus@linaro.org> wrote:
> The `__counted_by_ptr` macro was recently introduced [1] to extend
> bounds checking semantics to standard dynamically allocated pointers.
>
> However, the new Python implementation of kernel-doc does not currently
> recognize it as a compiler attribute. When kernel-doc encounters a
> struct member annotated with this macro, it fails to parse the variable
> name correctly, resulting in false-positive warnings like:
>
> Warning: ... struct member '__counted_by_ptr(cmdcnt' not described
>
> Add `__counted_by_ptr` to the `struct_xforms` regex list so it gets
> safely stripped out during the parsing phase, mirroring the existing
> behavior for `__counted_by`. Update the corresponding unit tests.
>
> Link: https://git.kernel.org/torvalds/c/150a04d817d8 [1]
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
> tools/lib/python/kdoc/xforms_lists.py | 1 +
> tools/unittests/test_cmatch.py | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/tools/lib/python/kdoc/xforms_lists.py b/tools/lib/python/kdoc/xforms_lists.py
> index f6ea9efb11ae..118156ea8cd2 100644
> --- a/tools/lib/python/kdoc/xforms_lists.py
> +++ b/tools/lib/python/kdoc/xforms_lists.py
> @@ -29,6 +29,7 @@ class CTransforms:
> (CMatch("__aligned"), ""),
> (CMatch("__counted_by"), ""),
> (CMatch("__counted_by_(le|be)"), ""),
> + (CMatch("__counted_by_ptr"), ""),
> (CMatch("__guarded_by"), ""),
> (CMatch("__pt_guarded_by"), ""),
> (CMatch("__packed"), ""),
> diff --git a/tools/unittests/test_cmatch.py b/tools/unittests/test_cmatch.py
> index 7b996f83784d..109141cd2ab8 100755
> --- a/tools/unittests/test_cmatch.py
> +++ b/tools/unittests/test_cmatch.py
> @@ -320,6 +320,7 @@ class TestSubWithLocalXforms(TestCaseDiff):
> (CMatch('__aligned'), ' '),
> (CMatch('__counted_by'), ' '),
> (CMatch('__counted_by_(le|be)'), ' '),
> + (CMatch('__counted_by_ptr'), ' '),
> (CMatch('__guarded_by'), ' '),
> (CMatch('__pt_guarded_by'), ' '),
>
>
> ---
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> change-id: 20260506-kdoc-__counted_by_ptr-1e206f3f1dc1
>
> Best regards,
Thanks,
Mauro
next prev parent reply other threads:[~2026-05-12 6:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 11:04 [PATCH] docs: kernel-doc: python: strip __counted_by_ptr macro Tudor Ambarus
2026-05-06 22:24 ` Randy Dunlap
2026-05-11 20:08 ` Kees Cook
2026-05-12 6:20 ` Mauro Carvalho Chehab [this message]
2026-05-15 14:15 ` Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260512082003.4b36bdaf@foz.lan \
--to=mchehab+huawei@kernel.org \
--cc=andre.draszik@linaro.org \
--cc=gustavoars@kernel.org \
--cc=jyescas@google.com \
--cc=kees@kernel.org \
--cc=kernel-team@android.com \
--cc=krzk@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=peter.griffin@linaro.org \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.