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 <[email protected]> Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent d3cc1b0 commit d1d3fcb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)