From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com,
simon.horman@corigine.com
Subject: Re: [PATCH net-next v4 1/5] net/sched: act_pedit: simplify 'ex' key parsing error propagation
Date: Thu, 20 Apr 2023 19:33:15 -0700 [thread overview]
Message-ID: <20230420193315.35e3e9e4@kernel.org> (raw)
In-Reply-To: <20230418234354.582693-2-pctammela@mojatatu.com>
On Tue, 18 Apr 2023 20:43:50 -0300 Pedro Tammela wrote:
> 'err' is returned -EINVAL most of the time.
> Make the exception be the netlink parsing and remove the
> redundant error assignments in the other code paths.
> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> index 4559a1507ea5..90f5214e679e 100644
> --- a/net/sched/act_pedit.c
> +++ b/net/sched/act_pedit.c
> @@ -54,46 +54,39 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla,
>
> nla_for_each_nested(ka, nla, rem) {
> struct nlattr *tb[TCA_PEDIT_KEY_EX_MAX + 1];
> + int ret;
>
> - if (!n) {
> - err = -EINVAL;
> + if (!n)
> goto err_out;
> - }
> n--;
IMHO this is not worth doing. Setting the error value before the jump
is more idiomatic. If anything I'd remove the unnecessary init of err
to EINVAL at the start of the function.
next prev parent reply other threads:[~2023-04-21 2:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 23:43 [PATCH net-next v4 0/5] net/sched: act_pedit: minor improvements Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 1/5] net/sched: act_pedit: simplify 'ex' key parsing error propagation Pedro Tammela
2023-04-19 9:37 ` Simon Horman
2023-04-21 2:33 ` Jakub Kicinski [this message]
2023-04-18 23:43 ` [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in 'ex' parsing errors Pedro Tammela
2023-04-19 9:39 ` Simon Horman
2023-04-21 2:36 ` Jakub Kicinski
2023-04-18 23:43 ` [PATCH net-next v4 3/5] net/sched: act_pedit: check static offsets a priori Pedro Tammela
2023-04-21 2:41 ` Jakub Kicinski
2023-04-21 15:12 ` Pedro Tammela
2023-04-21 15:15 ` Jakub Kicinski
2023-04-21 16:10 ` Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 4/5] net/sched: act_pedit: remove extra check for key type Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 5/5] net/sched: act_pedit: rate limit datapath messages Pedro Tammela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230420193315.35e3e9e4@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.com \
--cc=simon.horman@corigine.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).