aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-07-22 11:00:01 -0400
committerDavid S. Miller <davem@davemloft.net>2019-07-24 18:45:11 -0400
commit260637903f47f20c5918bb5c1eea52b2a28ea863 (patch)
tree80d4828fc09961777e350163b927cf66cf8c5665 /net/openvswitch
parent47b79bbb19e1cfc615823ccaac258cdd2c810c47 (diff)
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: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/datapath.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 892287d06c17..d01410e52097 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1047,7 +1047,7 @@ error:
1047} 1047}
1048 1048
1049/* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */ 1049/* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */
1050static struct sw_flow_actions *get_flow_actions(struct net *net, 1050static noinline_for_stack struct sw_flow_actions *get_flow_actions(struct net *net,
1051 const struct nlattr *a, 1051 const struct nlattr *a,
1052 const struct sw_flow_key *key, 1052 const struct sw_flow_key *key,
1053 const struct sw_flow_mask *mask, 1053 const struct sw_flow_mask *mask,
@@ -1081,12 +1081,13 @@ static struct sw_flow_actions *get_flow_actions(struct net *net,
1081 * we should not to return match object with dangling reference 1081 * we should not to return match object with dangling reference
1082 * to mask. 1082 * to mask.
1083 * */ 1083 * */
1084static int ovs_nla_init_match_and_action(struct net *net, 1084static noinline_for_stack int
1085 struct sw_flow_match *match, 1085ovs_nla_init_match_and_action(struct net *net,
1086 struct sw_flow_key *key, 1086 struct sw_flow_match *match,
1087 struct nlattr **a, 1087 struct sw_flow_key *key,
1088 struct sw_flow_actions **acts, 1088 struct nlattr **a,
1089 bool log) 1089 struct sw_flow_actions **acts,
1090 bool log)
1090{ 1091{
1091 struct sw_flow_mask mask; 1092 struct sw_flow_mask mask;
1092 int error = 0; 1093 int error = 0;