]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: rcar-host: Add OF Kconfig dependency to avoid objtool no-cfi warning
authorNathan Chancellor <nathan@kernel.org>
Tue, 14 Oct 2025 18:20:27 +0000 (11:20 -0700)
committerManivannan Sadhasivam <mani@kernel.org>
Thu, 18 Dec 2025 05:22:26 +0000 (10:52 +0530)
After commit 894af4a1cde6 ("objtool: Validate kCFI calls"), compile
testing pcie-rcar-host.c with CONFIG_FINEIBT=y and CONFIG_OF=n results
in a no-cfi objtool warning in rcar_pcie_probe():

  $ cat allno.config
  CONFIG_CFI=y
  CONFIG_COMPILE_TEST=y
  CONFIG_CPU_MITIGATIONS=y
  CONFIG_GENERIC_PHY=y
  CONFIG_MITIGATION_RETPOLINE=y
  CONFIG_MODULES=y
  CONFIG_PCI=y
  CONFIG_PCI_MSI=y
  CONFIG_PCIE_RCAR_HOST=y
  CONFIG_X86_KERNEL_IBT=y

  $ make -skj"$(nproc)" ARCH=x86_64 KCONFIG_ALLCONFIG=1 LLVM=1 clean allnoconfig vmlinux
  vmlinux.o: warning: objtool: rcar_pcie_probe+0x191: no-cfi indirect call!

When CONFIG_OF is unset, of_device_get_match_data() returns NULL, so
LLVM knows this indirect call has no valid destination and drops the
kCFI setup before the call, triggering the objtool check that makes sure
all indirect calls have kCFI setup.

This driver depends on OF for probing with non-NULL data for every match
so this call will never be NULL in practice. Add a hard Kconfig
dependency on OF to avoid the warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510092124.O2IX0Jek-lkp@intel.com/
Closes: https://github.com/ClangBuiltLinux/linux/issues/2134
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20251014-rcar_pcie_probe-avoid-nocfi-objtool-warning-v2-1-6e0204b002c6@kernel.org
drivers/pci/controller/Kconfig

index c254d2b8bf17b02aeea2e3a30db2ebe1c12f5fb1..2adf28949bec7a7988372c97a1e642307d30d47e 100644 (file)
@@ -243,6 +243,7 @@ config PCI_TEGRA
 config PCIE_RCAR_HOST
        bool "Renesas R-Car PCIe controller (host mode)"
        depends on ARCH_RENESAS || COMPILE_TEST
+       depends on OF
        depends on PCI_MSI
        select IRQ_MSI_LIB
        help