diff options
author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-02-27 18:39:33 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2025-03-02 08:30:11 -0800 |
commit | 69af654bf97232cf13a3924c27eac559b6fac951 (patch) | |
tree | 86a91bb6e3f2de828280375500f02ee376d13042 | |
parent | fafac0ebb289288c767272d600644701e0df8a76 (diff) |
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: https://github.com/KSPP/linux/issues/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>
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 787683e83db6..cdde8b03a6e9 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1470,8 +1470,7 @@ static int pmbus_add_label(struct pmbus_data *data, snprintf(label->name, sizeof(label->name), "%s%d_label", name, seq); if (!index) { if (phase == 0xff) - strncpy(label->label, lstring, - sizeof(label->label) - 1); + strscpy(label->label, lstring); else snprintf(label->label, sizeof(label->label), "%s.%d", lstring, phase); |