netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: tom@quantonium.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next 3/6] flow_dissector: Add protocol specific flow dissection offload
Date: Tue, 29 Aug 2017 18:00:24 -0700 (PDT)	[thread overview]
Message-ID: <20170829.180024.322953630308674415.davem@davemloft.net> (raw)
In-Reply-To: <20170829232711.1465-4-tom@quantonium.net>

From: Tom Herbert <tom@quantonium.net>
Date: Tue, 29 Aug 2017 16:27:08 -0700

> +#define GOTO_BY_RESULT(ret) do {				\
> +	switch (ret) {						\
> +	case FLOW_DISSECT_RET_OUT_GOOD:				\
> +		goto out_good;					\
> +	case FLOW_DISSECT_RET_PROTO_AGAIN:			\
> +		goto proto_again;				\
> +	case FLOW_DISSECT_RET_IPPROTO_AGAIN:			\
> +		goto ip_proto_again;				\
> +	case FLOW_DISSECT_RET_OUT_BAD:				\
> +	default:						\
> +		goto out_bad;					\
> +	}							\
> +} while (0)
> +
> +#define GOTO_OR_CONT_BY_RESULT(ret) do {			\
> +	enum flow_dissect_ret __ret = (ret);			\
> +								\
> +	if (__ret != FLOW_DISSECT_RET_CONTINUE)			\
> +		GOTO_BY_RESULT(__ret);				\
> +} while (0)

Please don't hide major control flow changes inside of a macro.  This
means returns and gotos.

It makes code impossible to audit.

Yes, this applies even if the macro has the word "GOTO" in it :-)

  reply	other threads:[~2017-08-30  1:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 23:27 [PATCH v2 net-next 0/6] flow_dissector: Protocol specific flow dissector offload Tom Herbert
2017-08-29 23:27 ` [PATCH v2 net-next 1/6] flow_dissector: Move ETH_P_TEB processing to main switch Tom Herbert
2017-08-29 23:27 ` [PATCH v2 net-next 2/6] udp: Constify skb argument in lookup functions Tom Herbert
2017-08-30  0:58   ` David Miller
2017-08-30  3:09     ` Tom Herbert
2017-08-29 23:27 ` [PATCH v2 net-next 3/6] flow_dissector: Add protocol specific flow dissection offload Tom Herbert
2017-08-30  1:00   ` David Miller [this message]
2017-08-29 23:27 ` [PATCH v2 net-next 4/6] udp: flow dissector offload Tom Herbert
2017-08-30 10:36   ` Paolo Abeni
2017-08-30 14:56     ` Tom Herbert
2017-08-31 15:53     ` Willem de Bruijn
2017-08-29 23:27 ` [PATCH v2 net-next 5/6] fou: Support flow dissection Tom Herbert
2017-08-29 23:27 ` [PATCH v2 net-next 6/6] vxlan: support flow dissect Tom Herbert
2017-08-30  8:41 ` [PATCH v2 net-next 0/6] flow_dissector: Protocol specific flow dissector offload Hannes Frederic Sowa
2017-08-30 14:50   ` Tom Herbert
2017-08-31 10:11     ` Hannes Frederic Sowa

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=20170829.180024.322953630308674415.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tom@quantonium.net \
    /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).