From: sashiko-bot@kernel.org
To: "Sean Rhodes" <sean@starlabs.systems>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v11 4/4] firmware: coreboot: Add CFR firmware attributes driver
Date: Tue, 04 Aug 2026 10:27:40 +0000 [thread overview]
Message-ID: <20260804102741.D64F11F000E9@smtp.kernel.org> (raw)
In-Reply-To: <4022650144cca8c242c6507825b29988adb6ac69.1785838269.git.sean@starlabs.systems>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Memory leak of enum label string when it contains invalid characters.
--
--- Patch [4]: [PATCH v11 4/4] firmware: coreboot: Add CFR firmware attributes driver ---
commit ea61591b8dd6ac619938eac5285db7c41217e27e
Author: Sean Rhodes <sean@starlabs.systems>
firmware: coreboot: Add CFR firmware attributes driver
This commit adds a firmware-attributes driver for the coreboot CFR table
entry to describe firmware setup options. It exposes runtime EFI
variable-backed boolean, enum, and integer settings through sysfs.
Link: https://doc.coreboot.org/drivers/cfr.html
Link: https://doc.coreboot.org/drivers/cfr_internal.html
> diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/coreboot/coreboot-cfr.c
> new file mode 100644
> index 0000000000000..1dfb2d29046b6
> --- /dev/null
> +++ b/drivers/firmware/coreboot/coreboot-cfr.c
[ ... ]
> +static int coreboot_cfr_copy_enum_values(struct coreboot_cfr_setting *setting,
> + const void *base, size_t len)
> +{
[ ... ]
> + for (;;) {
> + entry = coreboot_cfr_next_entry(&iterator);
[ ... ]
> + value = &setting->values[setting->n_values];
> + value->label = coreboot_cfr_string_dup(label);
> + if (!value->label)
> + return -ENOMEM;
> + if (!coreboot_cfr_string_is_valid_label(value->label))
> + return -EINVAL;
[Severity: Medium]
Does this code leak the newly allocated value->label string?
When coreboot_cfr_string_is_valid_label() fails and returns -EINVAL,
setting->n_values has not been incremented yet. If the caller then cleans up
the error by calling coreboot_cfr_free_setting(), the cleanup loop:
static void coreboot_cfr_free_setting(struct coreboot_cfr_setting *setting)
{
unsigned int i;
for (i = 0; i < setting->n_values; i++)
kfree(setting->values[i].label);
...
will skip freeing the string that was just allocated because setting->n_values
does not include it yet. Should kfree() be called on value->label before
returning -EINVAL here?
> +
> + value->value = enum_value->value;
> + setting->n_values++;
> + }
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1785838269.git.sean@starlabs.systems?part=4
prev parent reply other threads:[~2026-08-04 10:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 10:13 [PATCH v11 0/4] coreboot CFR firmware attributes Sean Rhodes
2026-08-04 10:13 ` [PATCH v11 1/4] platform/x86: Sort firmware attributes class includes Sean Rhodes
2026-08-04 10:13 ` [PATCH v11 2/4] firmware: Move firmware attributes class helper Sean Rhodes
2026-08-04 10:13 ` [PATCH v11 3/4] firmware: Rename google firmware directory to coreboot Sean Rhodes
2026-08-04 11:02 ` Krzysztof Kozlowski
2026-08-04 11:04 ` Krzysztof Kozlowski
2026-08-04 11:24 ` Sean Rhodes
2026-08-04 11:28 ` Krzysztof Kozlowski
2026-08-11 20:21 ` Julius Werner
2026-08-04 10:13 ` [PATCH v11 4/4] firmware: coreboot: Add CFR firmware attributes driver Sean Rhodes
2026-08-04 10:27 ` 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=20260804102741.D64F11F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sean@starlabs.systems \
/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.