Return-Path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:50256 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753553AbeCFRI1 (ORCPT ); Tue, 6 Mar 2018 12:08:27 -0500 Received: by mail-wm0-f67.google.com with SMTP id w128so24378667wmw.0 for ; Tue, 06 Mar 2018 09:08:26 -0800 (PST) From: Simon Horman To: Jiri Pirko , Jamal Hadi Salim , Cong Wang Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Simon Horman Subject: [PATCH/RFC 1/3] net/sched: act_tunnel_key: disambiguate metadata dst error cases Date: Tue, 6 Mar 2018 18:08:03 +0100 Message-Id: <20180306170805.19500-2-simon.horman@netronome.com> In-Reply-To: <20180306170805.19500-1-simon.horman@netronome.com> References: <20180306170805.19500-1-simon.horman@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Metadata may be NULL for one of two reasons: * Missing user input * Failure to allocate the metadata dst Disambiguate these case by returning -EINVAL for the former and -ENOMEM for the latter rather than -EINVAL for both cases. This is in preparation for using extended ack to provide more information to users when parsing their input. Signed-off-by: Simon Horman Reviewed-by: Jakub Kicinski --- net/sched/act_tunnel_key.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 9169b7e78ada..7ce95538177b 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -143,10 +143,13 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, dst_port, 0, flags, key_id, 0); + } else { + ret = -EINVAL; + goto err_out; } if (!metadata) { - ret = -EINVAL; + ret = -ENOMEM; goto err_out; } -- 2.11.0