Skip to content

RFC overflow: Convert size_add() to take variadic arguments

Andy Shevchenko linux-hardening linux-wireless lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2overflow: Allow to sum a few arguments at onceinclude/linux/overflow.h+26 -1114 replies
2/2wifi: nl80211: Call size_add() only oncenet/wireless/nl80211.c+4 -70 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchKees Cook
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [rfc, PATCH v1 0/2] overflow: Convert size_add() to take variadic arguments

This is an RFC!

We have already users that want add sizes of up to 5 arguments and I know about at least one that also wants 3 or 4.

This is brave move to make size_add() to take variadic arguments. The second patch is an example of use.

The implementation includes a case with a single argument on a purpose. In the future it might be extended to take an array as an argument, something like

	int sizes[21];
	size_add(sizes);

where the first element is amount of entries in the array (the same format as used in get_options() call) or other possible variants. This can be distinguished by _Generic().

But it may be dropped and we require always two arguments at minimum.

The RFC just to collect opinions and perception. Note, array3*(), min3()/max3() and all like that also can use similar approach.

Andy Shevchenko (2):
overflow: Allow to sum a few arguments at once
wifi: nl80211: Call size_add() only once

 include/linux/overflow.h | 37 ++++++++++++++++++++++++++-----------
 net/wireless/nl80211.c   | 11 ++++-------
 2 files changed, 30 insertions(+), 18 deletions(-)
Signature · 1 line
2.50.1