Skip to contentSkip to conversation

char: agp: intel-agp: check the return value of pci_find_capability()

PATCH New Jia-Ju Bai 1 participant 1 message Feb 25, 2022 Agpgart driver

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 char: agp: intel-agp: check the return value of pci_find_capability()

The function pci_find_capability() in agp_intel_probe() can fail, so its return value should be checked.

---
 drivers/char/agp/intel-agp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/char/agp/intel-agp.c +2 -0
index 9e4f27a6cb5a..6a7e385bde8a 100644
@@ -730,6 +730,8 @@ static int agp_intel_probe(struct pci_dev *pdev,
 	int i, err;
 
 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+	if (!cap_ptr)
+		return -ENODEV;
 
 	bridge = agp_alloc_bridge();
 	if (!bridge)
Signature · 1 line
2.17.1