Skip to content

Two fixes to avoid "-Wstrict-overflow" warnings

Thomas Haller netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3nft: add NFT_ARRAY_SIZE() helperinclude/nft.h+2 -02 replies
2/3nfnl_osf: rework nf_osf_parse_opt() and avoid "-Wstrict-overflow" warningsrc/nfnl_osf.c+58 -707 replies
3/3netlink_linearize: avoid strict-overflow warning in netlink_gen_bitwise()src/netlink_linearize.c+3 -42 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nft 0/3] Two fixes to avoid "-Wstrict-overflow" warnings

The "-Wstrict-overflow=5" warning seems useful, as it's easy to get this wrong. I think C really should have "-fwrapv" behavior, but the reality is that we need to be careful about signed overflow. The warning helps with that, and luckily there are only a few places that require fixes. Note that libparser and mini-gmp.c cannot build with "-Wstrict-overflow=5".

Maybe there are other warnings, as it depends on the optimization level and the compiler. This works for my gcc and -O3.

Thomas Haller (3):
nft: add NFT_ARRAY_SIZE() helper
nfnl_osf: rework nf_osf_parse_opt() and avoid "-Wstrict-overflow"
warning
netlink_linearize: avoid strict-overflow warning in
netlink_gen_bitwise()

 include/nft.h           |   2 +
 src/netlink_linearize.c |   7 +--
 src/nfnl_osf.c          | 128 ++++++++++++++++++----------------------
 3 files changed, 63 insertions(+), 74 deletions(-)
Signature · 1 line
2.41.0