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
effectively produces dead code when tools are built because they don't
call acpi_ut_safe_strncpy().
Accordingly, drop the existing definition of acpi_ut_safe_strncpy() and
define it as a strscpy_pad() alias.
Fixes: 292db66afd20 ("ACPICA: Unbreak tools build after switching over to strscpy_pad()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Tweak the changelog ]
Link: https://patch.msgid.link/12941764.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
#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
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
/*
* OSL interfaces added by Linux
*/
+#define acpi_ut_safe_strncpy strscpy_pad
#endif /* __KERNEL__ */