From: Thorsten Blum <thorsten.blum@linux.dev>
To: Mattia Dongili <malattia@linux.it>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] sonypi: use strscpy() in sonypi_acpi_probe
Date: Fri, 24 Apr 2026 09:57:57 +0200 [thread overview]
Message-ID: <20260424075755.305770-3-thorsten.blum@linux.dev> (raw)
strcpy() has been deprecated¹ because it performs no bounds checking on
the destination buffer, which can lead to buffer overflows. While the
current code works correctly, replace strcpy() with the safer strscpy()
to follow secure coding best practices.
¹ https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Based on linux-next and the new function name sonypi_acpi_probe().
---
drivers/char/sonypi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index ccda997a9098..959949f04f7d 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -37,6 +37,7 @@
#include <linux/kfifo.h>
#include <linux/platform_device.h>
#include <linux/gfp.h>
+#include <linux/string.h>
#include <linux/string_choices.h>
#include <linux/uaccess.h>
@@ -1120,8 +1121,8 @@ static int sonypi_acpi_probe(struct platform_device *pdev)
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
sonypi_acpi_device = device;
- strcpy(acpi_device_name(device), "Sony laptop hotkeys");
- strcpy(acpi_device_class(device), "sony/hotkey");
+ strscpy(acpi_device_name(device), "Sony laptop hotkeys");
+ strscpy(acpi_device_class(device), "sony/hotkey");
return 0;
}
next reply other threads:[~2026-04-24 7:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 7:57 Thorsten Blum [this message]
2026-04-24 8:34 ` Arnd Bergmann
2026-04-28 16:05 ` Ilpo Järvinen
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=20260424075755.305770-3-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=malattia@linux.it \
--cc=platform-driver-x86@vger.kernel.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®