[PATCH v1] ACPICA: Define acpi_ut_safe_strncpy() as strscpy_pad() alias
From: Rafael J. Wysocki
Date: Tue Jun 30 2026 - 12:09:47 EST
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Commit 292db66afd20 ("ACPICA: Unbreak tools build after switching over
to strscpy_pad()") added an #ifdef based on a __KERNEL_ check which is
sort of nasty to the acpi_ut_safe_strncpy() definition to unbreak ACPICA
tools builds broken by commit 97f7d3f9c9ac ("ACPICA: Replace strncpy()
with strscpy_pad() in acpi_ut_safe_strncpy()"). However, that #ifdef
is not even necessary because the tools don't call acpi_ut_safe_strncpy()
and so it doesn't need to be defined in tools builds at all.
Accordingly, define acpi_ut_safe_strncpy() as a strscpy_pad() alias for
kernel builds and drop its existing definition entirely.
Fixes: 292db66afd20 ("ACPICA: Unbreak tools build after switching over to strscpy_pad()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/acpica/acutils.h | 2 --
drivers/acpi/acpica/utnonansi.c | 16 ----------------
include/acpi/platform/aclinuxex.h | 1 +
3 files changed, 1 insertion(+), 18 deletions(-)
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -626,8 +626,6 @@ void acpi_ut_repair_name(char *name);
#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
-void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
-
u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
u8
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -164,20 +164,4 @@ acpi_ut_safe_strncat(char *dest,
return (FALSE);
}
-void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
-{
- /* Always terminate destination string */
-
-#ifdef __KERNEL__
- strscpy_pad(dest, source, dest_size);
-#else
- /*
- * strscpy_pad() is not defined in ACPICA tools builds, so use strncpy()
- * and directly NUL-terminate the destination string in that case.
- */
- strncpy(dest, source, dest_size);
- dest[dest_size - 1] = 0;
-#endif
-}
-
#endif
--- a/include/acpi/platform/aclinuxex.h
+++ b/include/acpi/platform/aclinuxex.h
@@ -134,6 +134,7 @@ static inline void acpi_os_terminate_deb
/*
* OSL interfaces added by Linux
*/
+#define acpi_ut_safe_strncpy strscpy_pad
#endif /* __KERNEL__ */