Skip to content

Commit d1d3fcb

Browse files
keesjankara
authored andcommitted
udf: Annotate struct udf_bitmap with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct udf_bitmap. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Jan Kara <jack@suse.com> Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230915201404.never.574-kees@kernel.org>
1 parent d3cc1b0 commit d1d3fcb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/udf/udf_sb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct udf_virtual_data {
8686
struct udf_bitmap {
8787
__u32 s_extPosition;
8888
int s_nr_groups;
89-
struct buffer_head *s_block_bitmap[];
89+
struct buffer_head *s_block_bitmap[] __counted_by(s_nr_groups);
9090
};
9191

9292
struct udf_part_map {

0 commit comments

Comments
 (0)