Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches

PATCH In review Kees Cook 2 participants 2 messages May 29, 2025 – Jun 13, 2025 x86 platform drivers

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches

When KCOV is enabled all functions get instrumented, unless the __no_sanitize_coverage attribute is used. To prepare for __no_sanitize_coverage being applied to __init functions[1], we have to handle differences in how GCC's inline optimizations get resolved. For thinkpad_acpi routines, this means forcing two functions to be inline with __always_inline.

---
This is split out of https://lore.kernel.org/lkml/[email protected]/
at Ilpo's request.
---
Cc: "Ilpo Järvinen" <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>

---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +2 -2
index 657625dd60a0..dc1fc069fed9 100644
@@ -558,12 +558,12 @@ static unsigned long __init tpacpi_check_quirks(
 	return 0;
 }
 
-static inline bool __pure __init tpacpi_is_lenovo(void)
+static __always_inline bool __pure __init tpacpi_is_lenovo(void)
 {
 	return thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO;
 }
 
-static inline bool __pure __init tpacpi_is_ibm(void)
+static __always_inline bool __pure __init tpacpi_is_ibm(void)
 {
 	return thinkpad_id.vendor == PCI_VENDOR_ID_IBM;
 }
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Kees Cook

When KCOV is enabled all functions get instrumented, unless the __no_sanitize_coverage attribute is used. To prepare for __no_sanitize_coverage being applied to __init functions[1], we have to handle differences in how GCC's inline optimizations get resolved. For thinkpad_acpi routines, this means forcing two functions to be inline with __always_inline.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches

      commit: 6418a8504187dc7f5b6f9d0649c03e362cb0664b

--
i.