mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 22:22:08 +02:00
bcachefs: Fix check_snapshot() memcpy
check_snapshot() copies the bch_snapshot to a temporary to easily handle older versions that don't have all the fields of the current version, but it lacked a min() to correctly handle keys newer and larger than the current version. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
097471f9e4
commit
c4333eb541
|
|
@ -728,7 +728,7 @@ static int check_snapshot(struct btree_trans *trans,
|
|||
return 0;
|
||||
|
||||
memset(&s, 0, sizeof(s));
|
||||
memcpy(&s, k.v, bkey_val_bytes(k.k));
|
||||
memcpy(&s, k.v, min(sizeof(s), bkey_val_bytes(k.k)));
|
||||
|
||||
id = le32_to_cpu(s.parent);
|
||||
if (id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user