netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/7] introduce DEFINE_FLEX() macro
@ 2023-08-16 14:06 Przemek Kitszel
  2023-08-16 14:06 ` [PATCH net-next v3 1/7] overflow: add DEFINE_FLEX() for on-stack allocs Przemek Kitszel
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Przemek Kitszel @ 2023-08-16 14:06 UTC (permalink / raw)
  To: Kees Cook, netdev
  Cc: Jacob Keller, intel-wired-lan, Alexander Lobakin, linux-hardening,
	Steven Zou, 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).

Obvious benefits include simpler resulting code, less heap usage,
less error checking. Less obvious is the fact that compiler has
more room to optimize, and as a whole, even with more stuff on the stack,
we end up with overall better (smaller) report from bloat-o-meter:
add/remove: 8/6 grow/shrink: 7/18 up/down: 2211/-2270 (-59)
(individual results in each patch).

v3: tidy up 1st patch
v2: Kees: reusing __struct_size() instead of doubling it as a new macro

Przemek Kitszel (7):
  overflow: add DEFINE_FLEX() for on-stack allocs
  ice: ice_sched_remove_elems: replace 1 elem array param by u32
  ice: drop two params of ice_aq_move_sched_elems()
  ice: make use of DEFINE_FLEX() in ice_ddp.c
  ice: make use of DEFINE_FLEX() for struct ice_aqc_add_tx_qgrp
  ice: make use of DEFINE_FLEX() for struct ice_aqc_dis_txq_item
  ice: make use of DEFINE_FLEX() in ice_switch.c

 drivers/net/ethernet/intel/ice/ice_common.c | 20 ++-----
 drivers/net/ethernet/intel/ice/ice_ddp.c    | 39 ++++---------
 drivers/net/ethernet/intel/ice/ice_lag.c    | 48 ++++------------
 drivers/net/ethernet/intel/ice/ice_lib.c    | 23 ++------
 drivers/net/ethernet/intel/ice/ice_sched.c  | 56 ++++++------------
 drivers/net/ethernet/intel/ice/ice_sched.h  |  6 +-
 drivers/net/ethernet/intel/ice/ice_switch.c | 63 +++++----------------
 drivers/net/ethernet/intel/ice/ice_xsk.c    | 22 +++----
 include/linux/compiler_types.h              | 32 +++++++----
 include/linux/fortify-string.h              |  4 --
 include/linux/overflow.h                    | 20 +++++++
 11 files changed, 115 insertions(+), 218 deletions(-)


base-commit: 479b322ee6feaff612285a0e7f22c022e8cd84eb
-- 
2.40.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-08-28 14:41 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 14:06 [PATCH net-next v3 0/7] introduce DEFINE_FLEX() macro Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 1/7] overflow: add DEFINE_FLEX() for on-stack allocs Przemek Kitszel
2023-08-16 16:35   ` kernel test robot
2023-08-18 10:37     ` Przemek Kitszel
2023-08-18 11:10       ` Miguel Ojeda
2023-08-18 12:07         ` Philip Li
2023-08-19 10:06         ` Greg KH
2023-08-16 20:38   ` Kees Cook
2023-08-17 14:35   ` David Laight
2023-08-17 17:00     ` Kees Cook
2023-08-18  7:14       ` David Laight
2023-08-18 10:28         ` Przemek Kitszel
2023-08-18 10:49           ` David Laight
2023-08-23 20:52             ` Przemek Kitszel
2023-08-28 14:41               ` Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 2/7] ice: ice_sched_remove_elems: replace 1 elem array param by u32 Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 3/7] ice: drop two params of ice_aq_move_sched_elems() Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 4/7] ice: make use of DEFINE_FLEX() in ice_ddp.c Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 5/7] ice: make use of DEFINE_FLEX() for struct ice_aqc_add_tx_qgrp Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 6/7] ice: make use of DEFINE_FLEX() for struct ice_aqc_dis_txq_item Przemek Kitszel
2023-08-16 14:06 ` [PATCH net-next v3 7/7] ice: make use of DEFINE_FLEX() in ice_switch.c Przemek Kitszel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).