The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Luis Chamberlain <mcgrof@kernel.org>,
	 Russ Weight <russ.weight@linux.dev>,
	Danilo Krummrich <dakr@kernel.org>
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] firmware_loader: builtin: ignore 0-size firmware
Date: Sat, 11 Jul 2026 15:11:53 -0700	[thread overview]
Message-ID: <alK_lhT0HOI7LXKT@google.com> (raw)
In-Reply-To: <20260426043041.649202-1-dmitry.torokhov@gmail.com>

On Sat, Apr 25, 2026 at 09:30:38PM -0700, Dmitry Torokhov wrote:
> Currently, the builtin firmware loader allows 0-size firmware to be
> returned successfully to drivers. This differs from all other loading
> mechanisms (filesystem, sysfs fallback) which reject 0-byte files, and
> forces drivers to add boilerplate size checks.
> 
> Modify firmware_request_builtin() to reject 0-size firmware. This will
> also result in firmware loader falling back to other mechanisms if an
> empty built-in firmware is present.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---

Gentle ping on this and the next one...

>  drivers/base/firmware_loader/builtin/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/base/firmware_loader/builtin/main.c b/drivers/base/firmware_loader/builtin/main.c
> index d36befebb1b9..1dcebe8e7f8e 100644
> --- a/drivers/base/firmware_loader/builtin/main.c
> +++ b/drivers/base/firmware_loader/builtin/main.c
> @@ -53,6 +53,8 @@ bool firmware_request_builtin(struct firmware *fw, const char *name)
>  
>  	for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
>  		if (strcmp(name, b_fw->name) == 0) {
> +			if (b_fw->size == 0)
> +				return false;
>  			fw->size = b_fw->size;
>  			fw->data = b_fw->data;
>  			return true;

-- 
Dmitry

  parent reply	other threads:[~2026-07-11 22:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-26  4:30 [PATCH 1/2] firmware_loader: builtin: ignore 0-size firmware Dmitry Torokhov
2026-04-26  4:30 ` [PATCH 2/2] firmware_loader: builtin: fail build on empty firmware Dmitry Torokhov
2026-07-11 23:58   ` Danilo Krummrich
2026-07-12  0:23     ` Dmitry Torokhov
2026-07-11 22:11 ` Dmitry Torokhov [this message]
2026-07-11 23:57   ` [PATCH 1/2] firmware_loader: builtin: ignore 0-size firmware Danilo Krummrich
2026-07-11 23:57 ` (subset) " Danilo Krummrich
2026-07-12  0:29 ` Danilo Krummrich

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=alK_lhT0HOI7LXKT@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=russ.weight@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox