]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Merge branch 'batch-1-annotate-structs-with-__counted_by'
authorJakub Kicinski <kuba@kernel.org>
Mon, 2 Oct 2023 18:25:03 +0000 (11:25 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 2 Oct 2023 18:25:04 +0000 (11:25 -0700)
Kees Cook says:

====================
Batch 1: Annotate structs with __counted_by

This is the batch 1 of patches touching netdev for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
====================

Link: https://lore.kernel.org/r/20230922172449.work.906-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Trivial merge