Message ID | 20171109004411.9193-3-cyril.bur@au1.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | Bug fix and coverity fixes | expand |
Cyril Bur <cyril.bur@au1.ibm.com> writes: > 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> > --- > core/pcie-slot.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) This one (I'm taking patches 2 and 3 now) merged to master as of a2f15d75c20f9a5912809094f52d532b5c7cff88
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;
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> --- core/pcie-slot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)