Commit 2cc9c0db authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix some memcpy() warnings

With CONFIG_FORTIFY_SOURCE, the compiler attempts to warn about mempcys
that extend past struct field boundaries. This results in some spurious
warnings where we use embedded variable length structs, this patch
switches to unsafe_mecpy() to fix the warnings.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 84464e57
...@@ -156,7 +156,8 @@ struct bch_fs_usage_online *bch2_fs_usage_read(struct bch_fs *c) ...@@ -156,7 +156,8 @@ struct bch_fs_usage_online *bch2_fs_usage_read(struct bch_fs *c)
do { do {
seq = read_seqcount_begin(&c->usage_lock); seq = read_seqcount_begin(&c->usage_lock);
memcpy(&ret->u, c->usage_base, u64s * sizeof(u64)); unsafe_memcpy(&ret->u, c->usage_base, u64s * sizeof(u64),
"embedded variable length struct");
for (i = 0; i < ARRAY_SIZE(c->usage); i++) for (i = 0; i < ARRAY_SIZE(c->usage); i++)
acc_u64s_percpu((u64 *) &ret->u, (u64 __percpu *) c->usage[i], u64s); acc_u64s_percpu((u64 *) &ret->u, (u64 __percpu *) c->usage[i], u64s);
} while (read_seqcount_retry(&c->usage_lock, seq)); } while (read_seqcount_retry(&c->usage_lock, seq));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment