Blame SOURCES/0090-tc-m_gact-Drop-dead-code.patch

36cfb7
From c6e0fc7a5ec0b890c35a3b5d4cc5e1f7794cc47f Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:07:22 +0200
36cfb7
Subject: [PATCH] tc/m_gact: Drop dead code
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit 73aa988868e7e
36cfb7
Conflicts: context change due to missing commits:
36cfb7
* e67aba5595811 ("tc: actions: add helpers to parse and print control actions")
36cfb7
* 18f05d06016d9 ("tc: gact: fix control action parsing")
36cfb7
36cfb7
commit 73aa988868e7e068b4fc0daaca7cfdb3e07fe744
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 17 19:09:31 2017 +0200
36cfb7
36cfb7
    tc/m_gact: Drop dead code
36cfb7
36cfb7
    The use of 'ok' variable in parse_gact() is ineffective: The second
36cfb7
    conditional increments it either if *argv is 'gact' or if
36cfb7
    parse_action_control() doesn't fail (in which case exit() is called).
36cfb7
    So this is effectively an unconditional increment and since no decrement
36cfb7
    happens anywhere, all remaining checks for 'ok != 0' can be dropped.
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 tc/m_gact.c | 18 +++++-------------
36cfb7
 1 file changed, 5 insertions(+), 13 deletions(-)
36cfb7
36cfb7
diff --git a/tc/m_gact.c b/tc/m_gact.c
36cfb7
index 755a3bee2c2f2..0cb5222fd3817 100644
36cfb7
--- a/tc/m_gact.c
36cfb7
+++ b/tc/m_gact.c
36cfb7
@@ -86,7 +86,6 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
36cfb7
 {
36cfb7
 	int argc = *argc_p;
36cfb7
 	char **argv = *argv_p;
36cfb7
-	int ok = 0;
36cfb7
 	int action = TC_POLICE_RECLASSIFY;
36cfb7
 	struct tc_gact p = { .action = TC_POLICE_RECLASSIFY };
36cfb7
 #ifdef CONFIG_GACT_PROB
36cfb7
@@ -100,25 +99,22 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
36cfb7
 
36cfb7
 
36cfb7
 	if (matches(*argv, "gact") == 0) {
36cfb7
-		ok++;
36cfb7
+		argc--;
36cfb7
+		argv++;
36cfb7
 	} else {
36cfb7
 		action = get_act(&argv);
36cfb7
 		if (action != -10) {
36cfb7
 			p.action = action;
36cfb7
-			ok++;
36cfb7
+			argc--;
36cfb7
+			argv++;
36cfb7
 		} else {
36cfb7
 			explain();
36cfb7
 			return action;
36cfb7
 		}
36cfb7
 	}
36cfb7
 
36cfb7
-	if (ok) {
36cfb7
-		argc--;
36cfb7
-		argv++;
36cfb7
-	}
36cfb7
-
36cfb7
 #ifdef CONFIG_GACT_PROB
36cfb7
-	if (ok && argc > 0) {
36cfb7
+	if (argc > 0) {
36cfb7
 		if (matches(*argv, "random") == 0) {
36cfb7
 			rd = 1;
36cfb7
 			NEXT_ARG();
36cfb7
@@ -167,15 +163,11 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
36cfb7
 			}
36cfb7
 			argc--;
36cfb7
 			argv++;
36cfb7
-			ok++;
36cfb7
 		} else if (matches(*argv, "help") == 0) {
36cfb7
 				usage();
36cfb7
 		}
36cfb7
 	}
36cfb7
 
36cfb7
-	if (!ok)
36cfb7
-		return -1;
36cfb7
-
36cfb7
 	tail = NLMSG_TAIL(n);
36cfb7
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
36cfb7
 	addattr_l(n, MAX_MSG, TCA_GACT_PARMS, &p, sizeof(p));
36cfb7
-- 
e138d9
2.21.0
36cfb7