mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 03:59:40 +02:00
bcachefs: replace strncpy() with memcpy_and_pad in journal_transaction_name
Strncpy is now deprecated. The buffer destination is not required to be NULL-terminated, but we also want to zero out the rest of the buffer as it is already done in other places. Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Roxana Nicolescu <nicolescu.roxana@protonmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8c087d2ddf
commit
4e2caf82ce
|
|
@ -20,6 +20,7 @@
|
|||
#include "snapshot.h"
|
||||
|
||||
#include <linux/prefetch.h>
|
||||
#include <linux/string_helpers.h>
|
||||
|
||||
static const char * const trans_commit_flags_strs[] = {
|
||||
#define x(n, ...) #n,
|
||||
|
|
@ -366,7 +367,8 @@ static noinline void journal_transaction_name(struct btree_trans *trans)
|
|||
struct jset_entry_log *l =
|
||||
container_of(entry, struct jset_entry_log, entry);
|
||||
|
||||
strncpy(l->d, trans->fn, JSET_ENTRY_LOG_U64s * sizeof(u64));
|
||||
memcpy_and_pad(l->d, JSET_ENTRY_LOG_U64s * sizeof(u64),
|
||||
trans->fn, strlen(trans->fn), 0);
|
||||
}
|
||||
|
||||
static inline int btree_key_can_insert(struct btree_trans *trans,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user