[Skiboot] [PATCH 1/3] hmi: Check for pci_get_phb() return value

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Sat Jul 11 01:25:46 AEST 2015


pci_get_phb() might return NULL, so add NULL return check
in handle_capp_recoverable().

Fixes Coverity defect#97843.

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
Cc: Ryan Grimm <grimm at linux.vnet.ibm.com>
---
 core/hmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/hmi.c b/core/hmi.c
index 0b9c7fb..f64a2bc 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -261,6 +261,8 @@ static int handle_capp_recoverable(int chip_id)
 
 		if ((phb_index == 0) && (chip_id == dt_chip_id)) {
 			phb = pci_get_phb(phb_id);
+			if (!phb)
+				return 0;
 			phb->ops->lock(phb);
 			phb->ops->set_capp_recovery(phb);
 			phb->ops->unlock(phb);
-- 
2.1.2



More information about the Skiboot mailing list