bcachefs: Fix a buffer overrun in bch2_fs_usage_read()
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 22 May 2023 18:39:44 +0000 (14:39 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:01 +0000 (17:10 -0400)
commit962210b281b327b236215c736b9f648369f0d39d
tree3a63cfebef930d3e6d116e75f4ec2c49621961cc
parent0b438c5bfaebda3fdf6edc35d9572d4e2f66aef1
bcachefs: Fix a buffer overrun in bch2_fs_usage_read()

We were copying the size of a struct bch_fs_usage_online to a struct
bch_fs_usage, which is 8 bytes smaller.

This adds some new helpers so we can do this correctly, and get rid of
some magic +1s too.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h