Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9150e81 authored by Pan Bian's avatar Pan Bian Committed by Mauro Carvalho Chehab
Browse files

[media] cobalt: fix unchecked return values



Function pci_find_ext_capability() may return 0, which is an invalid
address. In function cobalt_pcie_status_show(), its return value is used
without validation. This patch adds checks to validate the return
address.

Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 13174c38
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -205,6 +205,8 @@ void cobalt_pcie_status_show(struct cobalt *cobalt)

	offset = pci_find_capability(pci_dev, PCI_CAP_ID_EXP);
	bus_offset = pci_find_capability(pci_bus_dev, PCI_CAP_ID_EXP);
	if (!offset || !bus_offset)
		return;

	/* Device */
	pci_read_config_dword(pci_dev, offset + PCI_EXP_DEVCAP, &capa);