From: sashiko-bot@kernel.org
To: "Dave Airlie" <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/6] nouveau/gsp: add some more fields to r570 system info
Date: Wed, 29 Jul 2026 04:29:58 +0000 [thread overview]
Message-ID: <20260729042958.A327F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729041653.3985549-6-airlied@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The BAR index calculation for NVKM_BAR3_IO lacks bounds checking, leading to PCI ROM resource aliasing if all preceding BARs are 64-bit.
--
--- Patch [5]: [PATCH 5/6] nouveau/gsp: add some more fields to r570 system info ---
commit 18c8db5e682be4972a386c192c00409e01054607
Author: Dave Airlie <airlied@redhat.com>
nouveau/gsp: add some more fields to r570 system info
This commit adds the pci io bar, link cap and os page size to the r570
system info.
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
[ ... ]
> @@ -1576,6 +1576,10 @@ nvkm_device_pci_resource_idx(struct nvkm_device_pci *pdev, enum nvkm_bar_id bar)
> if (bar == NVKM_BAR2_INST)
> return idx;
>
> + idx += (pci_resource_flags(pdev->pdev, idx) & IORESOURCE_MEM_64) ? 2 : 1;
> + if (bar == NVKM_BAR3_IO)
> + return idx;
[Severity: Medium]
Does this calculation lack a bounds check against PCI_STD_NUM_BARS?
If a GPU is configured with three 64-bit BARs (BAR0, BAR1, and BAR2), the
calculation idx += 2 will occur three times. This results in idx becoming 6.
Since index 6 corresponds to PCI_ROM_RESOURCE, could this cause the IO BAR
lookup to accidentally alias with the PCI Expansion ROM resource?
> +
> WARN_ON(1);
> return -1;
> }
[ ... ]
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
[ ... ]
> @@ -165,6 +165,7 @@ r570_gsp_set_system_info(struct nvkm_gsp *gsp)
> info->gpuPhysAddr = device->func->resource_addr(device, NVKM_BAR0_PRI);
> info->gpuPhysFbAddr = device->func->resource_addr(device, NVKM_BAR1_FB);
> info->gpuPhysInstAddr = device->func->resource_addr(device, NVKM_BAR2_INST);
> + info->gpuPhysIoAddr = device->func->resource_addr(device, NVKM_BAR3_IO);
[Severity: Medium]
If the above index calculation results in 6 due to having three 64-bit BARs,
this assignment will populate info->gpuPhysIoAddr with the physical address
of the PCI Expansion ROM instead of a non-existent IO BAR.
Could exposing this incorrect hardware layout cause undefined firmware
behavior or hardware faults if the GSP firmware attempts to access the
ROM address assuming it is an IO space?
> info->nvDomainBusDeviceFunc = pci_dev_id(pdev);
> info->maxUserVa = TASK_SIZE;
> info->pciConfigMirrorBase = device->pci->func->cfg.addr;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260729041653.3985549-1-airlied@gmail.com?part=5
next prev parent reply other threads:[~2026-07-29 4:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 4:15 nouveau/gsp: some r570 additions and refactoring Dave Airlie
2026-07-29 4:15 ` [PATCH 1/6] nouveau/gsp: refactor libos entry handling for r535 Dave Airlie
2026-07-29 4:15 ` [PATCH 2/6] nouveau/gsp: make libos init per-gsp version Dave Airlie
2026-07-29 4:32 ` sashiko-bot
2026-07-29 4:15 ` [PATCH 3/6] nouveau/gsp: add logging entries for r570 Dave Airlie
2026-07-29 4:33 ` sashiko-bot
2026-07-29 4:15 ` [PATCH 4/6] nouveau/gsp: refactor the chan allocation arguments into a struct Dave Airlie
2026-07-29 4:15 ` [PATCH 5/6] nouveau/gsp: add some more fields to r570 system info Dave Airlie
2026-07-29 4:29 ` sashiko-bot [this message]
2026-07-29 4:15 ` [PATCH 6/6] nouveau: set wpr boost flags like open driver does Dave Airlie
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=20260729042958.A327F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.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.