From: sashiko-bot@kernel.org
To: "Deborah Brouwer" <deborah.brouwer@collabora.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org
Subject: Re: [PATCH v10 6/7] drm/tyr: add parser for firmware binary
Date: Tue, 28 Jul 2026 18:47:24 +0000 [thread overview]
Message-ID: <20260728184725.578181F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260728-fw-boot-b4-v10-6-9187aefa3f2f@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing validation that the firmware section data size does not exceed the virtual address mapping size.
- [Low] Crate-local imports in the `fw` module are not sorted alphabetically.
--
--- Patch [6]: [PATCH v10 6/7] drm/tyr: add parser for firmware binary ---
commit 2d4004e4d7f81ddd626b7391da06ddfa0d78eb29
Author: Daniel Almeida <daniel.almeida@collabora.com>
drm/tyr: add parser for firmware binary
This commit adds a parser for the Mali CSF GPU firmware binary format. It
extracts section metadata, validates the basic firmware structure and
alignment, and ignores protected-mode sections.
> diff --git a/drivers/gpu/drm/tyr/fw/parser.rs b/drivers/gpu/drm/tyr/fw/parser.rs
> new file mode 100644
> index 0000000000000..c4d0ad1d7899d
> --- /dev/null
> +++ b/drivers/gpu/drm/tyr/fw/parser.rs
[ ... ]
> +use crate::{
> + fw::{
> + CacheMode,
> + SectionFlags,
> + CSF_MCU_SHARED_REGION_START, //
[Severity: Low]
This isn't a bug, but the Rust coding guidelines require nested imports to be
sorted alphabetically. CSF_MCU_SHARED_REGION_START should be listed before
SectionFlags.
> + },
> + vm::{
> + VmFlag,
> + VmMapFlags, //
> + }, //
> +};
[ ... ]
> + fn parse_section_entry(
> + entry_cursor: &mut Cursor<'_>,
> + firmware_size: usize,
> + ) -> Result<Option<ParsedSection>> {
> + let section_hdr: SectionHeader = SectionHeader::new(entry_cursor)?;
> +
> + if section_hdr.data.end < section_hdr.data.start {
[Severity: Medium]
Does this code need to ensure the initialization data size doesn't exceed the
destination virtual address mapping size?
If a malformed firmware binary is provided where the data length
(data.end - data.start) is greater than the virtual address length
(va.end - va.start), could this lead to out-of-bounds writes when a firmware
loader uses the virtual address size for memory allocation but copies the
initialization data based on the binary data size?
> + dev_err!(
> + entry_cursor.dev,
> + "Firmware corrupted, data.end < data.start (0x{:x} < 0x{:x})",
> + section_hdr.data.end,
> + section_hdr.data.start
> + );
> + return Err(EINVAL);
> + }
> +
> + if section_hdr.data.end as usize > firmware_size {
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-fw-boot-b4-v10-0-9187aefa3f2f@collabora.com?part=6
next prev parent reply other threads:[~2026-07-28 18:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 18:39 [PATCH v10 0/7] drm/tyr: firmware loading and MCU boot support Deborah Brouwer
2026-07-28 18:39 ` [PATCH v10 1/7] drm/tyr: add resources to RegistrationData Deborah Brouwer
2026-07-28 18:55 ` sashiko-bot
2026-07-28 18:39 ` [PATCH v10 2/7] drm/tyr: add a generic slot manager Deborah Brouwer
2026-07-28 18:39 ` [PATCH v10 3/7] drm/tyr: add Memory Management Unit (MMU) support Deborah Brouwer
2026-07-28 18:52 ` sashiko-bot
2026-07-28 19:31 ` Danilo Krummrich
2026-07-28 20:35 ` Deborah Brouwer
2026-07-28 21:19 ` Danilo Krummrich
2026-07-28 18:39 ` [PATCH v10 4/7] drm/tyr: add GPU virtual memory (VM) support Deborah Brouwer
2026-07-28 18:54 ` sashiko-bot
2026-07-28 18:39 ` [PATCH v10 5/7] drm/tyr: add a kernel buffer object Deborah Brouwer
2026-07-28 18:54 ` sashiko-bot
2026-07-28 18:39 ` [PATCH v10 6/7] drm/tyr: add parser for firmware binary Deborah Brouwer
2026-07-28 18:47 ` sashiko-bot [this message]
2026-07-28 18:39 ` [PATCH v10 7/7] drm/tyr: add Microcontroller Unit (MCU) booting Deborah Brouwer
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=20260728184725.578181F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox