From: sashiko-bot@kernel.org
To: "Pedro Yudi Honda" <niyudi.honda@usp.br>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
dri-devel@lists.freedesktop.org, ojeda@kernel.org,
"Alexandre Courbot" <acourbot@nvidia.com>
Subject: Re: [PATCH 2/7] drm/nova: use `zerocopy` in vbios.rs
Date: Thu, 25 Jun 2026 21:14:28 +0000 [thread overview]
Message-ID: <20260625211428.B2BBF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625205146.5047-3-niyudi.honda@usp.br>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] VBIOS structures are parsed using native endianness, yielding incorrect values and validation failures on Big Endian architectures.
--
commit dfd6016814a03a8ecf36ea1b92019e446ec39712
Author: Pedro Yudi Honda <niyudi.honda@usp.br>
drm/nova: use zerocopy in vbios.rs
This commit replaces the transmute traits with their zerocopy equivalents
for parsing VBIOS structures. It updates the derive macros and changes the
initialization calls to use zerocopy's read_from_prefix().
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index e6d144587c4ee..a3c0c06f6818d 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
[ ... ]
> @@ -525,7 +513,7 @@ fn from_id(image: &PciAtBiosImage, token_id: u8) -> Result<Self> {
> ///
> /// This header is at the beginning of every image in the set of images in the ROM. It contains a
> /// pointer to the PCI Data Structure which describes the image.
> -#[derive(Debug, Clone, Copy)]
> +#[derive(Debug, Clone, Copy, FromBytes)]
> #[repr(C)]
> struct PciRomHeader {
> /// 00h: Signature (0xAA55)
> signature: u16,
[Severity: High]
This is a pre-existing issue, but does mapping this byte stream directly into
native integer types break on Big Endian architectures?
Since VBIOS data is typically little-endian, parsing it into native integer
types (like the u16 signature here, or the u16 id in BitHeader) means the
bytes will be interpreted backwards on Big Endian systems. For example, the
signature 0xAA55 would be read as 0x55AA, causing validation to fail entirely.
Additionally, in VbiosIterator::read_more(), the data is read via try_read32()
and converted to a byte stream using .to_ne_bytes(), which scrambles the byte
order in 4-byte chunks on Big Endian platforms.
Should these structures be using explicit little-endian types (like __le16)
to ensure correct VBIOS parsing across all architectures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260625205146.5047-1-niyudi.honda@usp.br?part=2
next prev parent reply other threads:[~2026-06-25 21:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 20:51 [RESEND PATCH 0/7] drm/nova: replace `transmute` with `zerocopy` Pedro Yudi Honda
2026-06-25 20:51 ` [PATCH 1/7] drm/nova: use `zerocopy` in firmware.rs Pedro Yudi Honda
2026-06-25 20:51 ` [PATCH 2/7] drm/nova: use `zerocopy` in vbios.rs Pedro Yudi Honda
2026-06-25 21:14 ` sashiko-bot [this message]
2026-06-25 20:51 ` [PATCH 3/7] drm/nova: use `zerocopy` in booter.rs Pedro Yudi Honda
2026-06-25 21:06 ` sashiko-bot
2026-06-25 20:51 ` [PATCH 4/7] drm/nova: use `zerocopy` in fwsec.rs Pedro Yudi Honda
2026-06-25 20:51 ` [PATCH 5/7] drm/nova: use `zerocopy` in bootloader.rs Pedro Yudi Honda
2026-06-25 20:51 ` [PATCH 6/7] drm/nova: use `zerocopy` in riscv.rs Pedro Yudi Honda
2026-06-25 20:51 ` [PATCH 7/7] drm/nova: remove unused trait in commands.rs Pedro Yudi Honda
2026-06-25 21:04 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-06-25 19:05 [PATCH 0/7] drm/nova: replace `transmute` with `zerocopy` Pedro Yudi Honda
2026-06-25 19:05 ` [PATCH 2/7] drm/nova: use `zerocopy` in vbios.rs Pedro Yudi Honda
2026-06-25 19:16 ` sashiko-bot
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=20260625211428.B2BBF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=niyudi.honda@usp.br \
--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 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.