Messages in this thread | | | Date | Mon, 18 Mar 2024 10:38:32 -0700 | From | Kees Cook <> | Subject | Re: [PATCH RFC kspp-next 0/3] compiler_types: add Endianness-dependent __counted_by_{le,be} |
| |
On Mon, Mar 18, 2024 at 02:03:51PM +0100, Alexander Lobakin wrote: > Some structures contain flexible arrays at the end and the counter for > them, but the counter has explicit Endianness and thus __counted_by() > can't be used directly. > > To increase test coverage for potential problems without breaking > anything, introduce __counted_by_{le,be} defined depending on platform's > Endianness to either __counted_by() when applicable or noop otherwise. > The first user will be virtchnl2.h from idpf just as example with 9 flex > structures having Little Endian counters.
Yeah, okay, that makes good sense. It'll give us as much coverage as we can get until the compilers gain "expression" support for the 'counted_by' attribute.
Acked-by: Kees Cook <keescook@chromium.org>
-- Kees Cook
| |