On Wed, Jul 16, 2025 at 11:32:10PM -0700, Kees Cook wrote: > This really screams for a struct-based way to in-place declare a > seq_buf. The current macro only works on the stack. I think this > will work; I'll send a patch once I get it tested: > > #define DECLARE_SEQ_BUF(NAME, SIZE) \ > char NAME##_buffer[size]; \ > struct seq_buf NAME = { \ > .buffer = &NAME##_buffer, \ > .size = SIZE, \ > }
Oh, no, that wouldn't work in a struct -- there is a static initializer there. And my memory is short: this would have been a revert of commit 7a8e9cdf9405 ("seq_buf: Make DECLARE_SEQ_BUF() usable"). I don't think it's possible to construct a seq_buf in a struct without a runtime initialization. And that's true for anything that needs to actually set a value (size) for the data type to be usable. Hmpf. -- Kees Cook