* [bug report] crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)
@ 2025-12-02 7:47 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-12-02 7:47 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: linux-crypto
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-02 8:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 7:47 [bug report] crypto/ccp: Implement SEV-TIO PCIe IDE (phase1) Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox