From: Tom Herbert <redacted>
Date: Tue, 29 Aug 2017 16:27:08 -0700
quoted hunk ↗ jump to hunk
+#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 :-)