[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220225123100.25995-1-baijiaju1990@gmail.com>
Date: Fri, 25 Feb 2022 04:31:00 -0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: airlied@...ux.ie
Cc: linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] 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 <oslab@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
drivers/char/agp/intel-agp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 9e4f27a6cb5a..6a7e385bde8a 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -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)
--
2.17.1
Powered by blists - more mailing lists