summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-11-09 11:44:09 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-13 23:48:52 -0600
commita2f15d75c20f9a5912809094f52d532b5c7cff88 (patch)
tree20d18896fbff96a58d24d14cf17d13edf2132ea0 /core
parentd0f06269ed3cd3e09a9b04c5f70cb3d53a77a689 (diff)
downloadblackbird-skiboot-a2f15d75c20f9a5912809094f52d532b5c7cff88.tar.gz
blackbird-skiboot-a2f15d75c20f9a5912809094f52d532b5c7cff88.zip
core/pcie-slots: Fix coverity possible NULL dereference
Coverity has found a senario where there could be a NULL dereference, it is likely that in practice we wouldn't hit this. Coverity does point out that all other callers of pcie_slot_create() do check for the NULL return, as such it makes sense to add a check. Fixes: CID 173756 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/pcie-slot.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 77e356c8..c3069040 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -575,8 +575,9 @@ struct pci_slot *pcie_slot_create_dynamic(struct phb *phb,
*
* We have same issue with PEX8718 as above on "p8dnu" platform.
*/
- if (dt_node_is_compatible(dt_root, "supermicro,p8dnu") && slot->pd &&
- (slot->pd->vdid == 0x973310b5 || slot->pd->vdid == 0x871810b5))
+ if (dt_node_is_compatible(dt_root, "supermicro,p8dnu") && slot &&
+ slot->pd && (slot->pd->vdid == 0x973310b5 ||
+ slot->pd->vdid == 0x871810b5))
pci_slot_add_flags(slot, PCI_SLOT_FLAG_FORCE_POWERON);
return slot;
OpenPOWER on IntegriCloud