From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Bill Wendling <morbo@google.com>
Cc: Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Justin Stitt <justinstitt@google.com>,
linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
llvm@lists.linux.dev, codemender-patching+linux@google.com
Subject: Re: [PATCH] firewire: core: add __counted_by_ptr attribute to struct fw_device
Date: Sun, 27 Sep 2026 10:49:26 +0900 [thread overview]
Message-ID: <20260927014926.GC9201@sakamocchi.jp> (raw)
In-Reply-To: <20260925212552.125652-1-morbo@google.com>
On Fri, Sep 25, 2026 at 09:25:52PM +0000, Bill Wendling wrote:
> The GCC and Clang attribute '__counted_by_ptr' associates a pointer
> field with an integer field holding its element count. This enables
> runtime bounds checking by KASAN and UBSAN to prevent out-of-bounds
> accesses to the pointer.
>
> In 'struct fw_device' (defined in 'include/linux/firewire.h'), the
> field 'config_rom' is a pointer to the device's Configuration ROM data,
> and its associated element count is stored in 'config_rom_length'.
>
> Additionally, update the existing KUnit test in
> 'drivers/firewire/device-attribute-test.c' where 'config_rom_length'
> was incorrectly initialized with the byte size
> ('sizeof(simple_avc_config_rom)') instead of the element count
> ('ARRAY_SIZE(simple_avc_config_rom)'). This ensures the
> '__counted_by_ptr' bounds-checking annotation does not trigger any
> false-positive panics or compile/runtime checks.
>
> Cc: codemender-patching+linux@google.com
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <morbo@google.com>
> ---
> drivers/firewire/device-attribute-test.c | 4 ++--
> include/linux/firewire.h | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
Thank you to correct the KUnit tests as well. Applied to for-next branch.
Thanks
Takashi Sakamoto
prev parent reply other threads:[~2026-09-27 1:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 21:25 [PATCH] firewire: core: add __counted_by_ptr attribute to struct fw_device Bill Wendling
2026-09-27 1:49 ` Takashi Sakamoto [this message]
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=20260927014926.GC9201@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=codemender-patching+linux@google.com \
--cc=gustavoars@kernel.org \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@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.