From: Ahmed Salem <x0rw3ll@gmail.com>
To: robert.moore@intel.com, rafael.j.wysocki@intel.com, lenb@kernel.org
Cc: skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/2] ACPI: mark ACPI_COPY_NAMESEG destinations with __nonstring attribute
Date: Sun, 30 Mar 2025 07:54:50 +0200 [thread overview]
Message-ID: <a9bd2a1b490b4305c18f8473aab21c97e8902fb8.1743313252.git.x0rw3ll@gmail.com> (raw)
In-Reply-To: <cover.1743313252.git.x0rw3ll@gmail.com>
strncpy(), which ACPI_COPY_NAMESEG currently uses, is deprecated[1].
This patch is the first of two, ultimately replacing strncpy() with
strtomem(), avoiding future compiler warnings about truncation.
[1] https://github.com/KSPP/linux/issues/90
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
---
drivers/acpi/acpica/acdebug.h | 2 +-
drivers/acpi/prmt.c | 2 +-
drivers/acpi/sysfs.c | 4 ++--
include/acpi/actbl.h | 6 +++---
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | 2 +-
tools/power/acpi/tools/acpidump/apfiles.c | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 911875c5a5f1..2b56a8178f43 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -37,7 +37,7 @@ struct acpi_db_argument_info {
struct acpi_db_execute_walk {
u32 count;
u32 max_count;
- char name_seg[ACPI_NAMESEG_SIZE + 1];
+ char name_seg[ACPI_NAMESEG_SIZE + 1] __nonstring;
};
#define PARAM_LIST(pl) pl
diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index e549914a636c..ca70f01c940c 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -40,7 +40,7 @@ struct prm_buffer {
};
struct prm_context_buffer {
- char signature[ACPI_NAMESEG_SIZE];
+ char signature[ACPI_NAMESEG_SIZE] __nonstring;
u16 revision;
u16 reserved;
guid_t identifier;
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index a48ebbf768f9..a05d4032d4f1 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -307,9 +307,9 @@ static struct kobject *hotplug_kobj;
struct acpi_table_attr {
struct bin_attribute attr;
- char name[ACPI_NAMESEG_SIZE];
+ char name[ACPI_NAMESEG_SIZE] __nonstring;
int instance;
- char filename[ACPI_NAMESEG_SIZE+ACPI_INST_SIZE];
+ char filename[ACPI_NAMESEG_SIZE+ACPI_INST_SIZE] __nonstring;
struct list_head node;
};
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 451f6276da49..8aa60281e7db 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -66,12 +66,12 @@
******************************************************************************/
struct acpi_table_header {
- char signature[ACPI_NAMESEG_SIZE]; /* ASCII table signature */
+ char signature[ACPI_NAMESEG_SIZE] __nonstring; /* ASCII table signature */
u32 length; /* Length of table in bytes, including this header */
u8 revision; /* ACPI Specification minor version number */
u8 checksum; /* To make sum of entire table == 0 */
- char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
- char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
+ char oem_id[ACPI_OEM_ID_SIZE] __nonstring; /* ASCII OEM identification */
+ char oem_table_id[ACPI_OEM_TABLE_ID_SIZE] __nonstring; /* ASCII OEM table identification */
u32 oem_revision; /* OEM revision number */
char asl_compiler_id[ACPI_NAMESEG_SIZE]; /* ASCII ASL compiler vendor ID */
u32 asl_compiler_revision; /* ASL compiler version */
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
index 9d70d8c945af..52026b9e389e 100644
--- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
+++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
@@ -19,7 +19,7 @@ ACPI_MODULE_NAME("oslinuxtbl")
typedef struct osl_table_info {
struct osl_table_info *next;
u32 instance;
- char signature[ACPI_NAMESEG_SIZE];
+ char signature[ACPI_NAMESEG_SIZE] __nonstring;
} osl_table_info;
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c
index 13817f9112c0..5a39b7d9351d 100644
--- a/tools/power/acpi/tools/acpidump/apfiles.c
+++ b/tools/power/acpi/tools/acpidump/apfiles.c
@@ -103,7 +103,7 @@ int ap_open_output_file(char *pathname)
int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
{
- char filename[ACPI_NAMESEG_SIZE + 16];
+ char filename[ACPI_NAMESEG_SIZE + 16] __nonstring;
char instance_str[16];
ACPI_FILE file;
acpi_size actual;
--
2.47.2
next prev parent reply other threads:[~2025-03-30 5:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-30 5:53 [RFC PATCH 0/2] ACPI: replace deprecated strncpy() Ahmed Salem
2025-03-30 5:54 ` Ahmed Salem [this message]
2025-03-31 11:49 ` [RFC PATCH 1/2] ACPI: mark ACPI_COPY_NAMESEG destinations with __nonstring attribute Rafael J. Wysocki
2025-03-31 17:55 ` Ahmed Salem
2025-03-30 5:55 ` [RFC PATCH 2/2] ACPI: replace deprecated strncpy() with strtomem() Ahmed Salem
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=a9bd2a1b490b4305c18f8473aab21c97e8902fb8.1743313252.git.x0rw3ll@gmail.com \
--to=x0rw3ll@gmail.com \
--cc=acpica-devel@lists.linux.dev \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=skhan@linuxfoundation.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