Re: [GIT PULL] ACPI support fixes and cleanups for 7.2-rc1

From: Rafael J. Wysocki

Date: Mon Jun 29 2026 - 09:34:58 EST


On Monday, June 29, 2026 2:22:51 PM CEST Rafael J. Wysocki (Intel) wrote:
> On Fri, Jun 26, 2026 at 10:14 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Fri, 26 Jun 2026 at 10:54, Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> >
> > How about just adding a trivial strncpy_pad() to
> > <acpi/platform/acenv.h> or something. A place that already knows about
> > the whole "I'm building the app side" now.
> >
> > Hmm?
>
> Something like that or define acpi_ut_safe_strncpy() as an alias for
> strncpy_pad() when that's available.
>
> I'll figure this out.

So this can be done (on top of 7.2-rc1) and I prefer it to the current
code, so please let me know what you think:

---
drivers/acpi/acpica/acutils.h | 2 ++
drivers/acpi/acpica/utnonansi.c | 10 ++--------
include/acpi/platform/aclinuxex.h | 1 +
3 files changed, 5 insertions(+), 8 deletions(-)

--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -626,7 +626,9 @@ 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);

+#if !defined (acpi_ut_safe_strncpy)
void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
+#endif

u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);

--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -164,20 +164,14 @@ acpi_ut_safe_strncat(char *dest,
return (FALSE);
}

+#if !defined (acpi_ut_safe_strncpy)
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

#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__ */