Skip to content

Commit c12d7aa

Browse files
keestakaswie
authored andcommitted
firewire: Annotate struct fw_node 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 fw_node. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Takashi Sakamoto <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent ffc2532 commit c12d7aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firewire/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ struct fw_node {
191191
/* Upper layer specific data. */
192192
void *data;
193193

194-
struct fw_node *ports[];
194+
struct fw_node *ports[] __counted_by(port_count);
195195
};
196196

197197
static inline struct fw_node *fw_node_get(struct fw_node *node)

0 commit comments

Comments
 (0)