Skip to content

sctp: fix a plenty of flexible-array-nested warnings

Xin Long linux-hardening linux-sctp netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 4 repliesApplied 6/6

Patches in v1 All 6 applied

#Subject and filesSizeRepliesApplied
1/6sctp: delete the nested flexible array paramsinclude/linux/sctp.h include/net/sctp/sctp.h net/sctp/input.c +3 more+19 -190 repliesApplied
2/6sctp: delete the nested flexible array skipinclude/linux/sctp.h include/net/sctp/sctp.h net/sctp/stream_interleave.c+6 -62 repliesApplied
3/6sctp: delete the nested flexible array variableinclude/linux/sctp.h net/sctp/outqueue.c net/sctp/sm_sideeffect.c +1 more+11 -90 repliesApplied
4/6sctp: delete the nested flexible array peer_initinclude/net/sctp/structs.h net/sctp/associola.c net/sctp/sm_make_chunk.c +1 more+9 -100 repliesApplied
5/6sctp: delete the nested flexible array hmacinclude/linux/sctp.h net/sctp/auth.c net/sctp/sm_statefuns.c+3 -30 repliesApplied
6/6sctp: delete the nested flexible array payloadinclude/linux/sctp.h+1 -10 repliesApplied

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH net-next 0/6] sctp: fix a plenty of flexible-array-nested warnings

Paolo noticed a compile warning in SCTP,

../net/sctp/stream_sched_fc.c: note: in included file (through ../include/net/sctp/sctp.h):
../include/net/sctp/structs.h:335:41: warning: array of flexible structures

But not only this, there are actually quite a lot of such warnings in some SCTP structs. This patchset fixes most of warnings by deleting these nested flexible array members.

After this patchset, there are still some warnings left:

  # make C=2 CF="-Wflexible-array-nested" M=./net/sctp/
  ./include/net/sctp/structs.h:1145:41: warning: nested flexible array
  ./include/uapi/linux/sctp.h:641:34: warning: nested flexible array
  ./include/uapi/linux/sctp.h:643:34: warning: nested flexible array
  ./include/uapi/linux/sctp.h:644:33: warning: nested flexible array
  ./include/uapi/linux/sctp.h:650:40: warning: nested flexible array
  ./include/uapi/linux/sctp.h:653:39: warning: nested flexible array

the 1st is caused by __data[] in struct ip_options, not in SCTP; the others are in uapi, and we should not touch them.

Note that instead of completely deleting it, we just leave it as a comment in the struct, signalling to the reader that we do expect such variable parameters over there, as Marcelo suggested.

Xin Long (6):
sctp: delete the nested flexible array params
sctp: delete the nested flexible array skip
sctp: delete the nested flexible array variable
sctp: delete the nested flexible array peer_init
sctp: delete the nested flexible array hmac
sctp: delete the nested flexible array payload

 include/linux/sctp.h         | 18 +++++++++---------
 include/net/sctp/sctp.h      | 12 ++++++------
 include/net/sctp/structs.h   |  2 +-
 net/sctp/associola.c         |  5 +++--
 net/sctp/auth.c              |  2 +-
 net/sctp/input.c             |  2 +-
 net/sctp/outqueue.c          | 11 +++++++----
 net/sctp/sm_make_chunk.c     | 22 +++++++++++-----------
 net/sctp/sm_sideeffect.c     |  3 +--
 net/sctp/sm_statefuns.c      | 14 ++++++--------
 net/sctp/stream.c            |  2 +-
 net/sctp/stream_interleave.c |  4 ++--
 12 files changed, 49 insertions(+), 48 deletions(-)
Signature · 1 line
2.39.1