From: Dan Carpenter <dan.carpenter@linaro.org>
To: Alexey Kardashevskiy <aik@amd.com>
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)
Date: Tue, 2 Dec 2025 10:47:16 +0300 [thread overview]
Message-ID: <aS6ZhKHx-mZF3qRI@stanley.mountain> (raw)
Hello Alexey Kardashevskiy,
Commit 3532f6154971 ("crypto/ccp: Implement SEV-TIO PCIe IDE
(phase1)") from Nov 21, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/crypto/ccp/sev-dev-tsm.c:266 dsm_create()
error: we previously assumed 'pdev->bus' could be null (see line 264)
drivers/crypto/ccp/sev-dev-tsm.c
261 static int dsm_create(struct tio_dsm *dsm)
262 {
263 struct pci_dev *pdev = dsm->tsm.base_tsm.pdev;
264 u8 segment_id = pdev->bus ? pci_domain_nr(pdev->bus) : 0;
^^^^^^^^^
This line assumes "pdev->bus" can be NULL.
265 struct pci_dev *rootport = pcie_find_root_port(pdev);
--> 266 u16 device_id = pci_dev_id(pdev);
^^^^
Unchecked dereference.
267 u16 root_port_id;
268 u32 lnkcap = 0;
269
270 if (pci_read_config_dword(rootport, pci_pcie_cap(rootport) + PCI_EXP_LNKCAP,
271 &lnkcap))
272 return -ENODEV;
273
274 root_port_id = FIELD_GET(PCI_EXP_LNKCAP_PN, lnkcap);
275
276 return sev_tio_dev_create(&dsm->data, device_id, root_port_id, segment_id);
277 }
regards,
dan carpenter
reply other threads:[~2025-12-02 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aS6ZhKHx-mZF3qRI@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=aik@amd.com \
--cc=linux-crypto@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