Re: [PATCH net-next v5 0/7] introduce DEFINE_FLEX() macro

2023-09-12 Thread Kees Cook
On Tue, Sep 12, 2023 at 07:59:30AM -0400, Przemek Kitszel wrote: > Add DEFINE_FLEX() macro, that helps on-stack allocation of structures > with trailing flex array member. > Expose __struct_size() macro which reads size of data allocated > by DEFINE_FLEX(). > > Accompany new macros introduction wi

[PATCH net-next v5 7/7] ice: make use of DEFINE_FLEX() in ice_switch.c

2023-09-12 Thread Przemek Kitszel
Use DEFINE_FLEX() macro for 1-elem flex array members of ice_switch.c Signed-off-by: Przemek Kitszel --- add/remove: 2/2 grow/shrink: 3/6 up/down: 489/-470 (19) --- drivers/net/ethernet/intel/ice/ice_switch.c | 63 + 1 file changed, 14 insertions(+), 49 deletions(-) diff --g

[PATCH net-next v5 6/7] ice: make use of DEFINE_FLEX() for struct ice_aqc_dis_txq_item

2023-09-12 Thread Przemek Kitszel
Use DEFINE_FLEX() macro for 1-elem flex array use case of struct ice_aqc_dis_txq_item. Signed-off-by: Przemek Kitszel --- add/remove: 0/0 grow/shrink: 1/1 up/down: 9/-18 (-9) --- drivers/net/ethernet/intel/ice/ice_common.c | 20 1 file changed, 4 insertions(+), 16 deletions(

[PATCH net-next v5 5/7] ice: make use of DEFINE_FLEX() for struct ice_aqc_add_tx_qgrp

2023-09-12 Thread Przemek Kitszel
Use DEFINE_FLEX() macro for 1-elem flex array use case of struct ice_aqc_add_tx_qgrp. Signed-off-by: Przemek Kitszel --- add/remove: 0/2 grow/shrink: 2/2 up/down: 220/-255 (-35) --- drivers/net/ethernet/intel/ice/ice_lib.c | 23 +-- drivers/net/ethernet/intel/ice/ice_xsk.c |

[PATCH net-next v5 4/7] ice: make use of DEFINE_FLEX() in ice_ddp.c

2023-09-12 Thread Przemek Kitszel
Use DEFINE_FLEX() macro for constant-num-of-elems (4) flex array members of ice_ddp.c Signed-off-by: Przemek Kitszel --- add/remove: 4/0 grow/shrink: 0/1 up/down: 1195/-878 (317) --- drivers/net/ethernet/intel/ice/ice_ddp.c | 39 +++- 1 file changed, 11 insertions(+), 28 dele

[PATCH net-next v5 3/7] ice: drop two params of ice_aq_move_sched_elems()

2023-09-12 Thread Przemek Kitszel
Remove two arguments of ice_aq_move_sched_elems(). Last of them was always NULL, and @grps_req was always 1. Assuming @grps_req to be one, allows us to use DEFINE_FLEX() macro, what removes some need for heap allocations. Signed-off-by: Przemek Kitszel --- add/remove: 0/0 grow/shrink: 1/6 up/dow

[PATCH net-next v5 2/7] ice: ice_sched_remove_elems: replace 1 elem array param by u32

2023-09-12 Thread Przemek Kitszel
Replace array+size params of ice_sched_remove_elems:() by just single u32, as all callers are using it with "1". This enables moving from heap-based, to stack-based allocation, what is also more elegant thanks to DEFINE_FLEX() macro. Signed-off-by: Przemek Kitszel --- add/remove: 2/2 grow/shrink

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

2023-09-12 Thread Przemek Kitszel
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 st

[PATCH net-next v5 0/7] introduce DEFINE_FLEX() macro

2023-09-12 Thread Przemek Kitszel
Add DEFINE_FLEX() macro, that helps on-stack allocation of structures with trailing flex array member. Expose __struct_size() macro which reads size of data allocated by DEFINE_FLEX(). Accompany new macros introduction with actual usage, in the ice driver - hence targeting for netdev tree. Obviou