Commit 26063790 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

ovs: datapath: hide clang frame-overflow warnings

Some functions in the datapath code are factored out so that each
one has a stack frame smaller than 1024 bytes with gcc. However,
when compiling with clang, the functions are inlined more aggressively
and combined again so we get

net/openvswitch/datapath.c:1124:12: error: stack frame size of 1528 bytes in function 'ovs_flow_cmd_set' [-Werror,-Wframe-larger-than=]

Marking both get_flow_actions() and ovs_nla_init_match_and_action()
as 'noinline_for_stack' gives us the same behavior that we see with
gcc, and no warning. Note that this does not mean we actually use
less stack, as the functions call each other, and we still get
three copies of the large 'struct sw_flow_key' type on the stack.

The comment tells us that this was previously considered safe,
presumably since the netlink parsing functions are called with
a known backchain that does not also use a lot of stack space.

Fixes: 9cc9a5cb ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47b79bbb
...@@ -1047,7 +1047,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info) ...@@ -1047,7 +1047,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
} }
/* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */ /* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */
static struct sw_flow_actions *get_flow_actions(struct net *net, static noinline_for_stack struct sw_flow_actions *get_flow_actions(struct net *net,
const struct nlattr *a, const struct nlattr *a,
const struct sw_flow_key *key, const struct sw_flow_key *key,
const struct sw_flow_mask *mask, const struct sw_flow_mask *mask,
...@@ -1081,12 +1081,13 @@ static struct sw_flow_actions *get_flow_actions(struct net *net, ...@@ -1081,12 +1081,13 @@ static struct sw_flow_actions *get_flow_actions(struct net *net,
* we should not to return match object with dangling reference * we should not to return match object with dangling reference
* to mask. * to mask.
* */ * */
static int ovs_nla_init_match_and_action(struct net *net, static noinline_for_stack int
struct sw_flow_match *match, ovs_nla_init_match_and_action(struct net *net,
struct sw_flow_key *key, struct sw_flow_match *match,
struct nlattr **a, struct sw_flow_key *key,
struct sw_flow_actions **acts, struct nlattr **a,
bool log) struct sw_flow_actions **acts,
bool log)
{ {
struct sw_flow_mask mask; struct sw_flow_mask mask;
int error = 0; int error = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment