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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux