char: agp: intel-agp: check the return value of pci_find_capability()
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.
Reported-by TOTE Robot <[email protected]>
Signed-off-by Jia-Ju Bai <[email protected]>
--- drivers/char/agp/intel-agp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/char/agp/intel-agp.c +2 -0
@@ -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