All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bill Wendling" <morbo@google.com>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2] gpiolib: annotate struct acpi_gpio_mapping with __counted_by_ptr
Date: Fri, 02 Oct 2026 12:55:11 +0000	[thread overview]
Message-ID: <20261002125512.16EDE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261002124226.435265-1-morbo@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] efi/libstub: incomplete removal of __counted_by attribute
--

commit db43ca0ac71b2e4fee34adfbd304bb5744b340e2
Author: Bill Wendling <morbo@google.com>

gpiolib: annotate struct acpi_gpio_mapping with __counted_by_ptr

This commit annotates the data pointer in struct acpi_gpio_mapping with the
__counted_by_ptr attribute to improve bounds checking. It also undefines the
__counted_by and __counted_by_ptr macros in some of the EFI stub library
source files to prevent unsupported bounds-checking instrumentation that could
crash the boot firmware.

> diff --git a/drivers/firmware/efi/libstub/alignedmem.c b/drivers/firmware/efi/libstub/alignedmem.c
> index 31928bd87e0ff..36248a13f15b4 100644
> --- a/drivers/firmware/efi/libstub/alignedmem.c
> +++ b/drivers/firmware/efi/libstub/alignedmem.c
> @@ -1,5 +1,13 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> +/*
> + * The EFI stub doesn't execute in the context of the kernel, only in the
> + * context of boot firmware, which isn't the time or place to crash the kernel.
> + * Therefore, disable the __counted_by__ attribute.
> + */
> +#undef __counted_by
> +#undef __counted_by_ptr

[Severity: High]
Are there other EFI stub library files that need these attributes disabled?

The #undef directives appear to be applied to only 14 out of 45 source files
in drivers/firmware/efi/libstub/. Architecture-specific EFI stub files for
non-x86 platforms (e.g., drivers/firmware/efi/libstub/arm64-stub.c,
drivers/firmware/efi/libstub/riscv-stub.c) and generic core files
(e.g., drivers/firmware/efi/libstub/vsprintf.c, drivers/firmware/efi/libstub/fdt.c, 
drivers/firmware/efi/libstub/zboot.c) were not updated.

These files still include <linux/efi.h>, which ultimately pulls in
<linux/compiler_attributes.h> and defines the macros globally. Compiling the
EFI stub for non-x86 architectures or enabling generic features like zboot
could leave the unsupported annotations active, potentially causing build
errors or fatal boot-time panics.

Could this be solved by passing -U__counted_by and -U__counted_by_ptr via
KBUILD_CFLAGS in drivers/firmware/efi/libstub/Makefile, or by adding the
directives to a common header like efistub.h?

> +
>  #include <linux/efi.h>
>  #include <asm/efi.h>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261002124226.435265-1-morbo@google.com?part=1

      reply	other threads:[~2026-10-02 12:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  6:38 [PATCH] gpiolib: annotate struct acpi_gpio_mapping with __counted_by_ptr Bill Wendling
2026-09-28  7:22 ` Bill Wendling
2026-10-01 19:56   ` Linus Walleij
2026-10-01 20:04     ` Bill Wendling
2026-10-01 21:24       ` Linus Walleij
2026-10-02  7:38         ` Ard Biesheuvel
2026-10-02 12:44           ` Bill Wendling
2026-10-02 13:51             ` Ard Biesheuvel
2026-10-03  8:54               ` Bill Wendling
2026-10-03  9:10                 ` Ard Biesheuvel
2026-10-05  9:31       ` Justin Stitt
2026-10-05 10:26         ` Bill Wendling
2026-10-07 11:19           ` Linus Walleij
2026-10-08 20:18             ` Bill Wendling
2026-10-02 12:42 ` [PATCH v2] " Bill Wendling
2026-10-02 12:55   ` sashiko-bot [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=20261002125512.16EDE1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=morbo@google.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.