From: Arnd Bergmann <arnd@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, "Richard Russon" <ldm@flatcap.org>,
Jens Axboe <axboe@kernel.dk>,
Robert Moore <robert.moore@intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <lenb@kernel.org>, Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>,
Lin Ming <ming.m.lin@intel.com>,
Alexey Starikovskiy <astarikovskiy@suse.de>,
linux-ntfs-dev@lists.sourceforge.net,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev,
linux-trace-kernel@vger.kernel.org
Subject: [PATCH 2/5] [v2] acpi: disable -Wstringop-truncation
Date: Tue, 9 Apr 2024 16:00:55 +0200 [thread overview]
Message-ID: <20240409140059.3806717-3-arnd@kernel.org> (raw)
In-Reply-To: <20240409140059.3806717-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
gcc -Wstringop-truncation warns about copying a string that results in a
missing nul termination:
drivers/acpi/acpica/tbfind.c: In function 'acpi_tb_find_table':
drivers/acpi/acpica/tbfind.c:60:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
60 | strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/acpica/tbfind.c:61:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
61 | strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The code works as intended, and the warning could be addressed by using
a memcpy(), but turning the warning off for this file works equally well
and may be easir to merge.
Fixes: 47c08729bf1c ("ACPICA: Fix for LoadTable operator, input strings")
Link: https://lore.kernel.org/lkml/CAJZ5v0hoUfv54KW7y4223Mn9E7D4xvR7whRFNLTBqCZMUxT50Q@mail.gmail.com/#t
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/acpi/acpica/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 30f3fc13c29d..8d18af396de9 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -5,6 +5,7 @@
ccflags-y := -D_LINUX -DBUILDING_ACPICA
ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
+CFLAGS_tbfind.o += $(call cc-disable-warning, stringop-truncation)
# use acpi.o to put all files here into acpi.o modparam namespace
obj-y += acpi.o
--
2.39.2
next prev parent reply other threads:[~2024-04-09 14:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 14:00 [PATCH 0/5 v2] address remaining stringop-truncation warnings Arnd Bergmann
2024-04-09 14:00 ` [PATCH 1/5] [v2] test_hexdump: avoid string truncation warning Arnd Bergmann
2024-04-10 21:04 ` Justin Stitt
2024-04-09 14:00 ` Arnd Bergmann [this message]
2024-04-09 15:05 ` [PATCH 2/5] [v2] acpi: disable -Wstringop-truncation Rafael J. Wysocki
2024-04-10 21:10 ` Justin Stitt
2024-04-09 14:00 ` [PATCH 3/5] [v2] block/partitions/ldm: convert strncpy() to strscpy() Arnd Bergmann
2024-04-09 14:00 ` [PATCH 4/5] [v2] blktrace: convert strncpy() to strscpy_pad() Arnd Bergmann
2024-04-10 21:13 ` Justin Stitt
2024-04-09 14:00 ` [PATCH 5/5] [v2] kbuild: enable -Wstringop-truncation globally Arnd Bergmann
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=20240409140059.3806717-3-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=acpica-devel@lists.linux.dev \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=astarikovskiy@suse.de \
--cc=axboe@kernel.dk \
--cc=ldm@flatcap.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=ming.m.lin@intel.com \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).