mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [GIT PULL] ACPI support fixes and cleanups for 7.2-rc1
Date: Mon, 29 Jun 2026 15:15:12 +0200	[thread overview]
Message-ID: <12935226.O9o76ZdvQC@rafael.j.wysocki> (raw)
In-Reply-To: <CAJZ5v0jQyELy6Zyqn-ngTmVG7Gj+CFMtL_t7qDEQjWSjgcLCmQ@mail.gmail.com>

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@linux-foundation.org> wrote:
> >
> > On Fri, 26 Jun 2026 at 10:54, Rafael J. Wysocki <rafael@kernel.org> 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__ */
 





  reply	other threads:[~2026-06-29 13:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 17:54 Rafael J. Wysocki
2026-06-26 20:13 ` Linus Torvalds
2026-06-26 20:31   ` Linus Torvalds
2026-06-29 12:22   ` Rafael J. Wysocki (Intel)
2026-06-29 13:15     ` Rafael J. Wysocki [this message]
2026-06-30 11:38       ` Rafael J. Wysocki
2026-06-26 20:31 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12935226.O9o76ZdvQC@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®