diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-12-16 09:53:53 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-12-16 09:53:53 -0300 |
commit | 1a931707ad4a46e79d4ecfee56d8f6e8cc8d4f28 (patch) | |
tree | c3ed4dafca580360da63eef576b35eb67eb2e5a2 /fs/btrfs/rcu-string.h | |
parent | 818448e9cf92e5c6b3c10320372eefcbe4174e4f (diff) | |
parent | 84e57d292203a45c96dbcb2e6be9dd80961d981a (diff) |
Merge remote-tracking branch 'torvalds/master' into perf/core
To resolve a trivial merge conflict with c302378bc157f6a7 ("libbpf:
Hashmap interface update to allow both long and void* keys/values"),
where a function present upstream was removed in the perf tools
development tree.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'fs/btrfs/rcu-string.h')
-rw-r--r-- | fs/btrfs/rcu-string.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/rcu-string.h b/fs/btrfs/rcu-string.h index 5c1a617eb25d..5c2b66d155ef 100644 --- a/fs/btrfs/rcu-string.h +++ b/fs/btrfs/rcu-string.h @@ -18,7 +18,11 @@ static inline struct rcu_string *rcu_string_strdup(const char *src, gfp_t mask) (len * sizeof(char)), mask); if (!ret) return ret; - strncpy(ret->str, src, len); + /* Warn if the source got unexpectedly truncated. */ + if (WARN_ON(strscpy(ret->str, src, len) < 0)) { + kfree(ret); + return NULL; + } return ret; } |