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: [email protected]
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <[email protected]>
> ---
>  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

Reply via email to