rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rhys Lloyd <krakow20@gmail.com>
To: acourbot@nvidia.com
Cc: Rhys Lloyd <krakow20@gmail.com>, rust-for-linux@vger.kernel.org
Subject: [PATCH] gpu: nova-core: fix bounds check in PmuLookupTableEntry::new
Date: Fri, 11 Jul 2025 07:29:51 -0700	[thread overview]
Message-ID: <20250711143141.9690-1-krakow20@gmail.com> (raw)

data is sliced from 2..6, but the bounds check data.len() < 5
does not satisfy those bounds.

Fixes: 47c4846e4319 ("gpu: nova-core: vbios: Add support for FWSEC ucode extraction")

Signed-off-by: Rhys Lloyd <krakow20@gmail.com>
---
Changes in v2:
- Ensure commit description does not spill into commit message
- Fix author to match SoB
- Add "Fixes:" tag
- Add base commit

---
 drivers/gpu/nova-core/vbios.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 663fc50e8b66..5b5d9f38cbb3 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -901,7 +901,7 @@ struct PmuLookupTableEntry {
 
 impl PmuLookupTableEntry {
     fn new(data: &[u8]) -> Result<Self> {
-        if data.len() < 5 {
+        if data.len() < 6 {
             return Err(EINVAL);
         }
 

base-commit: 215a3f91713383a3c0d2da82d223a608a3c17ac1
-- 
2.50.1


             reply	other threads:[~2025-07-11 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11 14:29 Rhys Lloyd [this message]
2025-07-11 14:29 ` [PATCH] gpu: nova-core: define named constants for magic numbers Rhys Lloyd
  -- strict thread matches above, loose matches on Subject: below --
2025-07-13  2:51 [PATCH] gpu: nova-core: fix bounds check in PmuLookupTableEntry::new Rhys Lloyd
2025-07-14  3:06 ` Alexandre Courbot
2025-07-17  5:15 ` Alexandre Courbot

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=20250711143141.9690-1-krakow20@gmail.com \
    --to=krakow20@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=rust-for-linux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).