* [PATCH iproute2] tc: q_ets: drop dead code from argument parsing
@ 2021-05-01 16:44 Andrea Claudi
2021-05-06 14:43 ` David Ahern
2021-05-06 14:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Andrea Claudi @ 2021-05-01 16:44 UTC (permalink / raw)
To: netdev; +Cc: stephen, dsahern
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@redhat.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2] tc: q_ets: drop dead code from argument parsing
2021-05-01 16:44 [PATCH iproute2] tc: q_ets: drop dead code from argument parsing Andrea Claudi
@ 2021-05-06 14:43 ` David Ahern
2021-05-06 14:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2021-05-06 14:43 UTC (permalink / raw)
To: Andrea Claudi, netdev; +Cc: stephen
On 5/1/21 10:44 AM, Andrea Claudi wrote:
> 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@redhat.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();
>
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2] tc: q_ets: drop dead code from argument parsing
2021-05-01 16:44 [PATCH iproute2] tc: q_ets: drop dead code from argument parsing Andrea Claudi
2021-05-06 14:43 ` David Ahern
@ 2021-05-06 14:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-06 14:50 UTC (permalink / raw)
To: Andrea Claudi; +Cc: netdev, stephen, dsahern
Hello:
This patch was applied to iproute2/iproute2-next.git (refs/heads/main):
On Sat, 1 May 2021 18:44:35 +0200 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [iproute2] tc: q_ets: drop dead code from argument parsing
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=a2f1f66075c8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-06 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 16:44 [PATCH iproute2] tc: q_ets: drop dead code from argument parsing Andrea Claudi
2021-05-06 14:43 ` David Ahern
2021-05-06 14:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.