Re: [PATCH] gpiolib: annotate struct acpi_gpio_mapping with __counted_by_ptr
From: Justin Stitt
Date: Mon Oct 05 2026 - 05:31:35 EST
Hi,
On Thu, Oct 01, 2026 at 01:04:47PM -0700, Bill Wendling wrote:
> On Thu, Oct 1, 2026 at 12:56 PM Linus Walleij <linusw@xxxxxxxxxx> wrote:
<snip>
> It's being #included transitively:
>
> In file included from drivers/firmware/efi/libstub/efi-stub-helper.c:12:
> In file included from ./include/linux/efi.h:20:
> In file included from ./include/linux/rtc.h:18:
> In file included from ./include/linux/nvmem-provider.h:16:
> ./include/linux/gpio/consumer.h:670:55: error: use of undeclared
> identifier 'size'; did you
> mean 'ksize'?
> 670 | const struct acpi_gpio_params *data __counted_by_ptr(size);
> | ^~~~
> | ksize
> ././include/linux/compiler_types.h:392:64: note: expanded from macro
> '__counted_by_ptr'
> 392 | #define __counted_by_ptr(member)
> __attribute__((__counted_by__(member)))
> |
> ^~~~~~
> ./include/linux/slab.h:602:8: note: 'ksize' declared here
> 602 | size_t ksize(const void *objp);
> | ^
>
I wonder if we could have a better warning here guiding you towards
-fexperimental-late-parse-attributes?
Thanks
Justin