Skip to contentSkip to conversation

platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()

PATCH In review Thorsten Blum 2 participants 2 messages Feb 25, 2025 – Mar 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()

Since kstrtol() requires a NUL-terminated string as input and strncpy() is deprecated for NUL-terminated destination buffers, use strscpy() instead.

Compile-tested only.

---
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +1 -1
index 0b277b7e37dd..889332ddd5ce 100644
@@ -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 == '\\' ||
Signature · 1 line
2.48.1
maintainer
#1 lore raw
Quoted 8 lines · Thorsten Blum

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.