diff options
author | Przemek Kitszel <przemyslaw.kitszel@intel.com> | 2023-09-12 07:59:31 -0400 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-10-03 12:17:10 -0700 |
commit | 26dd68d293fd1c5ac966fb5dd5f6d89de322a541 (patch) | |
tree | c38efdaa9ea3b814df341afd7d7ecdd92bb06036 /drivers/net/ethernet/intel/ice/ice_sched.c | |
parent | e643597346c72ebb961ee79ebec34acc042e8ac2 (diff) | |
download | linux-26dd68d293fd1c5ac966fb5dd5f6d89de322a541.tar.gz linux-26dd68d293fd1c5ac966fb5dd5f6d89de322a541.tar.bz2 linux-26dd68d293fd1c5ac966fb5dd5f6d89de322a541.zip |
overflow: add DEFINE_FLEX() for on-stack allocs
Add DEFINE_FLEX() macro for on-stack allocations of structs with
flexible array member.
Expose __struct_size() macro outside of fortify-string.h, as it could be
used to read size of structs allocated by DEFINE_FLEX().
Move __member_size() alongside it.
-Kees
Using underlying array for on-stack storage lets us to declare
known-at-compile-time structures without kzalloc().
Actual usage for ice driver is in following patches of the series.
Missing __has_builtin() workaround is moved up to serve also assembly
compilation with m68k-linux-gcc, see [1].
Error was (note the .S file extension):
In file included from ../include/linux/linkage.h:5,
from ../arch/m68k/fpsp040/skeleton.S:40:
../include/linux/compiler_types.h:331:5: warning: "__has_builtin" is not defined, evaluates to 0 [-Wundef]
331 | #if __has_builtin(__builtin_dynamic_object_size)
| ^~~~~~~~~~~~~
../include/linux/compiler_types.h:331:18: error: missing binary operator before token "("
331 | #if __has_builtin(__builtin_dynamic_object_size)
| ^
[1] https://lore.kernel.org/netdev/202308112122.OuF0YZqL-lkp@intel.com/
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://lore.kernel.org/r/20230912115937.1645707-2-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_sched.c')
0 files changed, 0 insertions, 0 deletions