* [PATCH] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()
@ 2025-02-25 23:21 Thorsten Blum
2025-03-03 14:32 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-02-25 23:21 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, Ilpo Järvinen
Cc: Thorsten Blum, linux-hardening, platform-driver-x86, linux-kernel
Since kstrtol() requires a NUL-terminated string as input and strncpy()
is deprecated for NUL-terminated destination buffers, use strscpy()
instead.
Compile-tested only.
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index 0b277b7e37dd..889332ddd5ce 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
@@ -448,7 +448,7 @@ int hp_convert_hexstr_to_str(const char *input, u32 input_len, char **str, int *
return -ENOMEM;
for (i = 0; i < input_len; i += 5) {
- strncpy(tmp, input + i, strlen(tmp));
+ strscpy(tmp, input + i);
if (kstrtol(tmp, 16, &ch) == 0) {
// escape char
if (ch == '\\' ||
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()
2025-02-25 23:21 [PATCH] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy() Thorsten Blum
@ 2025-03-03 14:32 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-03-03 14:32 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, Thorsten Blum
Cc: linux-hardening, platform-driver-x86, linux-kernel
On Wed, 26 Feb 2025 00:21:27 +0100, Thorsten Blum wrote:
> Since kstrtol() requires a NUL-terminated string as input and strncpy()
> is deprecated for NUL-terminated destination buffers, use strscpy()
> instead.
>
> Compile-tested only.
>
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()
commit: baa18b6ed4200aff869e78f2650123572b6a9ad6
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-03 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 23:21 [PATCH] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy() Thorsten Blum
2025-03-03 14:32 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox