On Wed, Jul 3, 2024 at 1:10 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > > +static size_t ri_size(int sessions_cnt) > > > +{ > > > + struct return_instance *ri __maybe_unused; > > > + > > > + return sizeof(*ri) + sessions_cnt * sizeof(ri->sessions[0]); > > > > just use struct_size()? > > Yeah, lets not. This is readable, struct_size() is not. This hack with __maybe_unused is more readable than the standard struct_size() helper that was added specifically for cases like this, really? I wonder if Kees agrees and whether there are any downsides to using struct_size() struct_size(struct return_instance, sessions, sessions_cnt) seems readable enough to me, in any case.