netfilter: cttimeout: remove VLA usage
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 12 Mar 2018 23:14:42 +0000 (18:14 -0500)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 20 Mar 2018 12:41:04 +0000 (13:41 +0100)
commit8039ab43eeac029a9c47c0411918ea82c9ce87cd
tree011831e1970bab8b521125d2be88c5694ab47922
parentd719e3f21cf91d3f82bd827d46199ba41af2f73a
netfilter: cttimeout: remove VLA usage

In preparation to enabling -Wvla, remove VLA and replace it
with dynamic memory allocation.

>From a security viewpoint, the use of Variable Length Arrays can be
a vector for stack overflow attacks. Also, in general, as the code
evolves it is easy to lose track of how big a VLA can get. Thus, we
can end up having segfaults that are hard to debug.

Also, fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621

While at it, remove likely() notation which is not necessary from the
control plane code.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_cttimeout.c