summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-12-28 23:17:07 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:48 +0300
commit2cc9c0db89f7b6e3c3218ddaa7964055af8d95af (patch)
tree23f8779e2fb1b7a123fd81d534bf98e9ceae3756 /fs/bcachefs
parent84464e57529b45e235c24bc7db24b60ffba7f540 (diff)
downloadlinux-2cc9c0db89f7b6e3c3218ddaa7964055af8d95af.tar.xz
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: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/buckets.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 49cb2589f47c..137a9aef6987 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -156,7 +156,8 @@ retry:
do {
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++)
acc_u64s_percpu((u64 *) &ret->u, (u64 __percpu *) c->usage[i], u64s);
} while (read_seqcount_retry(&c->usage_lock, seq));