OpenCloudOS-Kernel/arch/x86/pci
Samasth Norway Ananda e39cc0c37d x86/PCI: Check pcie_find_root_port() return for NULL
[ Upstream commit dbc3171194403d0d40e4bdeae666f6e76e428b53 ]

If pcie_find_root_port() is unable to locate a Root Port, it will return
NULL. Check the pointer for NULL before dereferencing it.

This particular case is in a quirk for devices that are always below a Root
Port, so this won't avoid a problem and doesn't need to be backported, but
check as a matter of style and to prevent copy/paste mistakes.

Link: https://lore.kernel.org/r/20240812202659.1649121-1-samasth.norway.ananda@oracle.com
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
[bhelgaas: drop Fixes: and explain why there's no problem in this case]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-04 16:29:29 +02:00
..
Makefile x86/PCI: Replace deprecated EXTRA_CFLAGS with ccflags-y 2019-11-21 07:49:27 -06:00
acpi.c x86/PCI: Use pr_info() when possible 2022-12-10 10:33:18 -06:00
amd_bus.c range.h: Move resource API and constant to respective files 2023-08-18 10:19:00 -07:00
broadcom_bus.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
bus_numa.c range.h: Move resource API and constant to respective files 2023-08-18 10:19:00 -07:00
bus_numa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ce4100.c x86/pci: Mark local functions as 'static' 2023-05-18 11:56:10 -07:00
common.c x86/PCI: Add kernel cmdline options to use/ignore E820 reserved regions 2022-05-19 14:26:55 -05:00
direct.c x86/pci: Simplify code by using the new dmi_get_bios_year() helper 2018-02-23 08:20:30 +01:00
early.c PCI: Make early dump functionality generic 2018-06-29 20:06:07 -05:00
fixup.c x86/PCI: Check pcie_find_root_port() return for NULL 2024-10-04 16:29:29 +02:00
i386.c x86/PCI: Make a kernel-doc comment a normal one 2020-11-27 13:43:09 +01:00
init.c x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init() 2021-02-10 22:06:47 +01:00
intel_mid_pci.c x86/pci/intel_mid_pci: Fix PCIBIOS_* return code handling 2024-08-03 08:53:21 +02:00
irq.c x86/PCI: Use struct_size() in pirq_convert_irt_table() 2023-07-13 11:33:20 -05:00
legacy.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
mmconfig-shared.c x86/pci: Skip early E820 check for ECAM region 2024-06-12 11:13:01 +02:00
mmconfig_32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 387 2019-06-05 17:37:11 +02:00
mmconfig_64.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
numachip.c x86/PCI: Add pci_numachip_init() declaration 2021-08-12 14:07:31 -05:00
olpc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pcbios.c maccess: rename probe_kernel_address to get_kernel_nofault 2020-06-18 11:14:40 -07:00
sta2x11-fixup.c swiotlb: provide swiotlb_init variants that remap the buffer 2022-04-18 07:21:13 +02:00
xen.c x86/pci/xen: Fix PCIBIOS_* return code handling 2024-08-03 08:53:21 +02:00