Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbdILWss (ORCPT ); Tue, 12 Sep 2017 18:48:48 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35306 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbdILWso (ORCPT ); Tue, 12 Sep 2017 18:48:44 -0400 X-Google-Smtp-Source: ADKCNb77eGenjb0SFfYWUYcgECWXsYkk1DNb+3yJAuvRHvMMvxe3HFyMDnAv3u5hEG6AP3mW4+ynBg== Subject: Re: [PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()' To: Christophe JAILLET , pshelar@nicira.com, davem@davemloft.net, xiangxia.m.yue@gmail.com Cc: netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20170911192015.17553-1-christophe.jaillet@wanadoo.fr> From: Greg Rose Message-ID: Date: Tue, 12 Sep 2017 15:48:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170911192015.17553-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1876 Lines: 50 On 09/11/2017 12:20 PM, Christophe JAILLET wrote: > All other error handling paths in this function go through the 'error' > label. This one should do the same. > > Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") > Signed-off-by: Christophe JAILLET > --- > I think that the comment above the function could be improved. It looks > like the commit log which has introduced this function. > > I'm also not sure that commit 9cc9a5cb176c is of any help. It is > supposed to remove a warning, and I guess it does. But 'ovs_nla_init_match_and_action()' > is called unconditionnaly from 'ovs_flow_cmd_set()'. So even if the stack > used by each function is reduced, the overall stack should be the same, if > not larger. > > So this commit sounds like adding a bug where the code was fine and states > to fix an issue but, at the best, only hides it. Having a large stack frame isn't really a bug per se. But the Linux kernel warns about stack frames that are too large so reordering the code to get the warning to go away seems fine to me. > > Instead of fixing the code with the proposed patch, reverting the initial > commit could also be considered. Then the warning will come back. - Greg > --- > net/openvswitch/datapath.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c > index 76cf273a56c7..c3aec6227c91 100644 > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c > @@ -1112,7 +1112,8 @@ static int ovs_nla_init_match_and_action(struct net *net, > if (!a[OVS_FLOW_ATTR_KEY]) { > OVS_NLERR(log, > "Flow key attribute not present in set flow."); > - return -EINVAL; > + error = -EINVAL; > + goto error; > } > > *acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], key, >