diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2025-05-01 18:44:43 -0600 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2025-05-08 09:42:05 -0700 |
commit | 47e36ed7840661a9f7fb53554a1b04a5f8daffea (patch) | |
tree | fba2363f5e2062513fd831cdfdbce55b4f70132b /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 6e6500e4e4a7f7431a6d7ab02a332ea5fca5c9fa (diff) |
overflow: Fix direct struct member initialization in _DEFINE_FLEX()
Currently, to statically initialize the struct members of the `type`
object created by _DEFINE_FLEX(), the internal `obj` member must be
explicitly referenced at the call site. See:
struct flex {
int a;
int b;
struct foo flex_array[];
};
_DEFINE_FLEX(struct flex, instance, flex_array,
FIXED_SIZE, = {
.obj = {
.a = 0,
.b = 1,
},
});
This leaks _DEFINE_FLEX() internal implementation details and make
the helper harder to use and read.
Fix this and allow for a more natural and intuitive C99 init-style:
_DEFINE_FLEX(struct flex, instance, flex_array,
FIXED_SIZE, = {
.a = 0,
.b = 1,
});
Note that before these changes, the `initializer` argument was optional,
but now it's required.
Also, update "counter" member initialization in DEFINE_FLEX().
Fixes: 26dd68d293fd ("overflow: add DEFINE_FLEX() for on-stack allocs")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/aBQVeyKfLOkO9Yss@kspp
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions