aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-11-19 10:20:38 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-11-19 10:20:38 -0500
commit8d8d9afb396f154f366f32948fdff3cf4e269841 (patch)
tree73f6778b1d2efe4d80f727025199a43af1a471b7
parent4c07d59936f8e28eadecab8f56ef14726f77ccb8 (diff)
parent3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f (diff)
downloadlinux-yocto-v5.8/standard/mti-malta32.tar.gz
linux-yocto-v5.8/standard/mti-malta32.tar.bz2
linux-yocto-v5.8/standard/mti-malta32.zip
Merge branch 'v5.8/standard/base' into v5.8/standard/mti-malta32v5.8/standard/mti-malta32
-rw-r--r--fs/ext4/super.c4
-rw-r--r--net/tipc/bearer.c5
2 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b38bf29c07e..9cf88162ab66 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -347,7 +347,7 @@ static void __save_error_info(struct super_block *sb, int error,
return;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
ext4_update_tstamp(es, s_last_error_time);
- strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
+ strscpy_pad(es->s_last_error_func, func, sizeof(es->s_last_error_func));
es->s_last_error_line = cpu_to_le32(line);
es->s_last_error_ino = cpu_to_le32(ino);
es->s_last_error_block = cpu_to_le64(block);
@@ -408,7 +408,7 @@ static void __save_error_info(struct super_block *sb, int error,
if (!es->s_first_error_time) {
es->s_first_error_time = es->s_last_error_time;
es->s_first_error_time_hi = es->s_last_error_time_hi;
- strncpy(es->s_first_error_func, func,
+ strscpy_pad(es->s_first_error_func, func,
sizeof(es->s_first_error_func));
es->s_first_error_line = cpu_to_le32(line);
es->s_first_error_ino = es->s_last_error_ino;
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index e366ec9a7e4d..c5896730e393 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -139,10 +139,7 @@ static int bearer_name_validate(const char *name,
u32 if_len;
/* copy bearer name & ensure length is OK */
- name_copy[TIPC_MAX_BEARER_NAME - 1] = 0;
- /* need above in case non-Posix strncpy() doesn't pad with nulls */
- strncpy(name_copy, name, TIPC_MAX_BEARER_NAME);
- if (name_copy[TIPC_MAX_BEARER_NAME - 1] != 0)
+ if (strscpy(name_copy, name, TIPC_MAX_BEARER_NAME) < 0)
return 0;
/* ensure all component parts of bearer name are present */