diff options
author | Justin Stitt <justinstitt@google.com> | 2024-03-18 22:36:10 +0000 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-03-27 14:57:44 +0100 |
commit | 03fa9a3ad1d61992a2105aeb1062b349f1a85012 (patch) | |
tree | 7cb6a16bde2f279807ff9afbcdfa000dd535243a /drivers/watchdog/rza_wdt.c | |
parent | b33f3d2677b8ddd7a3aba2b02497422a1d2c2a01 (diff) |
thermal: intel: int340x_thermal: replace deprecated strncpy() with strscpy()
strncpy() is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.
psvt->limit.string can only be 8 bytes so let's use the appropriate size
macro ACPI_LIMIT_STR_MAX_LEN.
Neither psvt->limit.string or psvt_user[i].limit.string requires the
NUL-padding behavior that strncpy() provides as they have both been
filled with NUL-bytes prior to the string operation.
| memset(&psvt->limit, 0, sizeof(u64));
and
| psvt_user = kzalloc(psvt_len, GFP_KERNEL);
Let's use `strscpy` [2] due to the fact that it guarantees
NUL-termination on the destination buffer without unnecessarily
NUL-padding.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings # [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/watchdog/rza_wdt.c')
0 files changed, 0 insertions, 0 deletions