RE: [PATCH net-next v3 1/7] overflow: add DEFINE_FLEX() for on-stack allocs

From
David Laight <hidden>
Date
2023-08-18 10:50:07
Also in
intel-wired-lan, linux-hardening
Reply to
Przemek Kitszel, 2023-08-18
From: Przemek Kitszel
Sent: Friday, August 18, 2023 11:28 AM
...
quoted
quoted
quoted
I'm not sure you should be forcing the memset() either.
This already got discussed: better to fail safe.
Perhaps call it DEFINE_FLEX_Z() to make this clear and
give the option for a non-zeroing version later.
Not everyone wants the expense of zeroing everything.
per Kees, zeroing should be removed by compiler when not needed:
https://lore.kernel.org/intel-wired-lan/202308101128.C4F0FA235@keescook/ (local)
Expect in the most trivial cases the compiler is pretty much never
going to remove the zeroing of the data[] part.

I'm also not at all sure what happens if there is a function
call between the initialisation and any assignments.

With a bit of effort you should be able to pass the '= {}'
through into an inner #define.
Possibly with the alternative of a caller-provider
 '= { .obj = call_supplied_initialiser }'
The 'not _Z' form would pass an empty argument.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Thread (21 messages) 21 messages, 7 authors, last reply 2023-08-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help