mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
bcachefs: Fix overflow in journal_replay_entry_early
If filesystem on disk was used by a version with a larger BCH_DATA_NR thas the currently running version, we don't want this to cause a buffer overrun. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
7ed158f294
commit
90d22a660a
@ -725,7 +725,7 @@ static int journal_replay_entry_early(struct bch_fs *c,
|
||||
ca->usage_base->buckets_ec = le64_to_cpu(u->buckets_ec);
|
||||
ca->usage_base->buckets_unavailable = le64_to_cpu(u->buckets_unavailable);
|
||||
|
||||
for (i = 0; i < nr_types; i++) {
|
||||
for (i = 0; i < min_t(unsigned, nr_types, BCH_DATA_NR); i++) {
|
||||
ca->usage_base->d[i].buckets = le64_to_cpu(u->d[i].buckets);
|
||||
ca->usage_base->d[i].sectors = le64_to_cpu(u->d[i].sectors);
|
||||
ca->usage_base->d[i].fragmented = le64_to_cpu(u->d[i].fragmented);
|
||||
|
Loading…
Reference in New Issue
Block a user