mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-20 06:26:09 -05:00
bcachefs: Switch to unsafe_memcpy() in a few places
The new fortify checking doesn't work for us in all places; this switches to unsafe_memcpy() where appropriate to silence a few warnings/errors. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -473,8 +473,9 @@ static inline int update_replicas_list(struct btree_trans *trans,
|
||||
d = trans->fs_usage_deltas;
|
||||
n = (void *) d->d + d->used;
|
||||
n->delta = sectors;
|
||||
memcpy((void *) n + offsetof(struct replicas_delta, r),
|
||||
r, replicas_entry_bytes(r));
|
||||
unsafe_memcpy((void *) n + offsetof(struct replicas_delta, r),
|
||||
r, replicas_entry_bytes(r),
|
||||
"flexible array member embedded in strcuct with padding");
|
||||
bch2_replicas_entry_sort(&n->r);
|
||||
d->used += b;
|
||||
return 0;
|
||||
|
||||
@@ -642,9 +642,11 @@ static inline void bch2_bkey_append_ptr(struct bkey_i *k, struct bch_extent_ptr
|
||||
|
||||
ptr.type = 1 << BCH_EXTENT_ENTRY_ptr;
|
||||
|
||||
memcpy((void *) &k->v + bkey_val_bytes(&k->k),
|
||||
&ptr,
|
||||
sizeof(ptr));
|
||||
unsafe_memcpy((void *) &k->v + bkey_val_bytes(&k->k),
|
||||
&ptr,
|
||||
sizeof(ptr),
|
||||
"Our memcpy target is relative to a zero size array ,"
|
||||
"compiler bounds checking doesn't work here");
|
||||
k->k.u64s++;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user