Skip to content

Commit 69af654

Browse files
tobluxgroeck
authored andcommitted
hwmon: (pmbus/core) Replace deprecated strncpy() with strscpy()
strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. Compile-tested only. Note(groeck): strscpy() uses sizeof() to determine the length of the destination buffer if it is not provided as argument. Link: KSPP#90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20250227173936.7746-2-thorsten.blum@linux.dev Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent fafac0e commit 69af654

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,7 @@ static int pmbus_add_label(struct pmbus_data *data,
14701470
snprintf(label->name, sizeof(label->name), "%s%d_label", name, seq);
14711471
if (!index) {
14721472
if (phase == 0xff)
1473-
strncpy(label->label, lstring,
1474-
sizeof(label->label) - 1);
1473+
strscpy(label->label, lstring);
14751474
else
14761475
snprintf(label->label, sizeof(label->label), "%s.%d",
14771476
lstring, phase);

0 commit comments

Comments
 (0)