]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: Annotate struct bucket_gens with __counted_by()
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 26 Oct 2024 15:47:04 +0000 (17:47 +0200)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:15 +0000 (01:36 -0500)
commit901ff6555ba02dd917aa65b1105c9715e25dc994
treeab1b401f6122c64ad37e3cc3d3785c9d16da3001
parentac9826f14739023bccf1345e6e4ddb0461fa9a2e
bcachefs: Annotate struct bucket_gens with __counted_by()

Add the __counted_by compiler attribute to the flexible array member b
to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Use struct_size() to calculate the number of bytes to be allocated.

Update bucket_gens->nbuckets and bucket_gens->nbuckets_minus_first when
resizing.

Compile-tested only.

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