]> git.baikalelectronics.ru Git - kernel.git/commit
flow_dissector: work around stack frame size warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 29 May 2020 20:13:58 +0000 (22:13 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Jun 2020 18:52:05 +0000 (11:52 -0700)
commit070fb2d2c6b4969661c72a607a81b66194749e8a
treeb2dbba1a0e05f151c3c61f5338c49d780549edde
parente3d6e19bf8cf4e1183b7f0088d8fc81a2c0cfd34
flow_dissector: work around stack frame size warning

The fl_flow_key structure is around 500 bytes, so having two of them
on the stack in one function now exceeds the warning limit after an
otherwise correct change:

net/sched/cls_flower.c:298:12: error: stack frame size of 1056 bytes in function 'fl_classify' [-Werror,-Wframe-larger-than=]

I suspect the fl_classify function could be reworked to only have one
of them on the stack and modify it in place, but I could not work out
how to do that.

As a somewhat hacky workaround, move one of them into an out-of-line
function to reduce its scope. This does not necessarily reduce the stack
usage of the outer function, but at least the second copy is removed
from the stack during most of it and does not add up to whatever is
called from there.

I now see 552 bytes of stack usage for fl_classify(), plus 528 bytes
for fl_mask_lookup().

Fixes: 3a8bdda5ec6a ("flow_dissector: Parse multiple MPLS Label Stack Entries")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_flower.c