Skip to contentSkip to conversation

fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks

PATCH Superseded Eric Dumazet 1 participant 2 messages Apr 25, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks

My intent was to not let users set a zero drop_batch_size, it seems I once again messed with min()/max().

---
 net/sched/sch_fq_codel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_fq_codel.c +1 -1
index 968519ff36e97734e495d90331d3e3197660b8f6..436160be9c180ceedaeb74126e40c7e24bf7ccba 100644
@@ -416,7 +416,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,
 		q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM]));
 
 	if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])
-		q->drop_batch_size = min(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]));
+		q->drop_batch_size = max(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]));
 
 	if (tb[TCA_FQ_CODEL_MEMORY_LIMIT])
 		q->memory_limit = min(1U << 31, nla_get_u32(tb[TCA_FQ_CODEL_MEMORY_LIMIT]));
Signature · 1 line
2.26.2.303.gf8c07b1a785-goog
#1 lore raw
Quoted 5 lines · Eric Dumazet

My intent was to not let users set a zero drop_batch_size, it seems I once again messed with min()/max().

Sorry, apparently the Fixes: tag did not make it.
Will send a V2.