dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	ojeda@kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/5] gpu: nova-core: rename heap size field
Date: Fri, 24 Jul 2026 07:04:08 +0000	[thread overview]
Message-ID: <20260724070409.264F01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-blackwell-fixes-v3-2-01aa6a54e3fd@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Framebuffer layout calculations use raw subtraction on hardware-provided values, leading to integer underflow if the hardware reports an insufficient framebuffer size.
--

--- Patch [2]: [PATCH v3 2/5] gpu: nova-core: rename heap size field ---
commit 11d9ee61e9c07ef3fa88364b2849b70d424c5735
Author: Eliot Courtney <ecourtney@nvidia.com>

gpu: nova-core: rename heap size field

This commit renames the heap field to non_wpr_heap in the nova-core driver's
framebuffer layout struct, unifying the naming convention.

> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index 273cff752fae7..1f7b6a69e4db8 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
[ ... ]
> @@ -251,9 +251,9 @@ pub(crate) fn new(chipset: Chipset, bar: Bar0<'_>, gsp_fw: &GspFirmware) -> Resu
>              FbRange(wpr2_addr..frts.end)
>          };
>  
> -        let heap = {
> -            let heap_size = u64::from(hal.non_wpr_heap_size());
> -            FbRange(wpr2.start - heap_size..wpr2.start)
> +        let non_wpr_heap = {
> +            let non_wpr_heap_size = u64::from(hal.non_wpr_heap_size());
> +            FbRange(wpr2.start - non_wpr_heap_size..wpr2.start)

[Severity: High]
This isn't a bug introduced by this patch, but could this subtraction underflow
if the hardware reports a framebuffer size smaller than the required components?

The layout calculations in FbLayout::new() sequentially subtract required
firmware region sizes from the total hardware-provided vidmem_size. For example,
an earlier calculation does fb.end - NV_PRAMIN_SIZE, which would underflow if
the reported size is less than 1MB. Similarly, the subtraction
wpr2.start - non_wpr_heap_size here will underflow if the accumulated
allocations exceed the total vidmem_size.

Could this cause a panic in debug builds, or wrap to a very large offset in
release builds, leading to memory corruption or crashes when interacting with
untrusted or malfunctioning hardware?

>          };
>  
>          Ok(Self {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-blackwell-fixes-v3-0-01aa6a54e3fd@nvidia.com?part=2

  reply	other threads:[~2026-07-24  7:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  6:56 [PATCH v3 0/5] gpu: nova-core: blackwell follow-ups and fixes Eliot Courtney
2026-07-24  6:56 ` [PATCH v3 1/5] gpu: nova-core: correct FRTS vidmem offset calculation Eliot Courtney
2026-07-24  7:16   ` sashiko-bot
2026-07-24 16:52   ` Timur Tabi
2026-07-28  7:29     ` Eliot Courtney
2026-07-24  6:56 ` [PATCH v3 2/5] gpu: nova-core: rename heap size field Eliot Courtney
2026-07-24  7:04   ` sashiko-bot [this message]
2026-07-24  6:56 ` [PATCH v3 3/5] gpu: nova-core: return non-WPR heap size as u64 from HALs Eliot Courtney
2026-07-24  7:04   ` sashiko-bot
2026-07-24  6:56 ` [PATCH v3 4/5] gpu: nova-core: split FbLayout into FSP and non-FSP versions Eliot Courtney
2026-07-28 14:00   ` Danilo Krummrich
2026-07-24  6:56 ` [PATCH v3 5/5] gpu: nova-core: pass WPR metadata ownership to FmcBootArgs Eliot Courtney

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=20260724070409.264F01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --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