lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat,  1 May 2021 18:44:35 +0200
From:   Andrea Claudi <aclaudi@...hat.com>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, dsahern@...il.com
Subject: [PATCH iproute2] tc: q_ets: drop dead code from argument parsing

Checking for nbands to be at least 1 at this point is useless. Indeed:
- ets requires "bands", "quanta" or "strict" to be specified
- if "bands" is specified, nbands cannot be negative, see parse_nbands()
- if "strict" is specified, nstrict cannot be negative, see
  parse_nbands()
- if "quantum" is specified, nquanta cannot be negative, see
  parse_quantum()
- if "bands" is not specified, nbands is set to nstrict+nquanta
- the previous if statement takes care of the case when none of them are
  specified and nbands is 0, terminating execution.

Thus nbands cannot be < 1 at this point and this code cannot be executed.

Signed-off-by: Andrea Claudi <aclaudi@...hat.com>
---
 tc/q_ets.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tc/q_ets.c b/tc/q_ets.c
index e7903d50..7380bb2f 100644
--- a/tc/q_ets.c
+++ b/tc/q_ets.c
@@ -147,11 +147,6 @@ parse_priomap:
 		explain();
 		return -1;
 	}
-	if (nbands < 1) {
-		fprintf(stderr, "The number of \"bands\" must be >= 1\n");
-		explain();
-		return -1;
-	}
 	if (nstrict + nquanta > nbands) {
 		fprintf(stderr, "Not enough total bands to cover all the strict bands and quanta\n");
 		explain();
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ