[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231213165741.93528-1-jhs@mojatatu.com>
Date: Wed, 13 Dec 2023 11:57:41 -0500
From: Jamal Hadi Salim <jhs@...atatu.com>
To: davem@...emloft.net,
kuba@...nel.org,
edumazet@...gle.com,
pabeni@...hat.com
Cc: jiri@...nulli.us,
xiyou.wangcong@...il.com,
netdev@...r.kernel.org,
pctammela@...atatu.com,
victor@...atatu.com,
Jamal Hadi Salim <jhs@...atatu.com>,
Coverity Scan <scan-admin@...erity.com>
Subject: [PATCH net 1/1] net_sched: sch_fq: Fix out of range band computation
It is possible to compute a band of 3. Doing so will overrun array
q->band_pkt_count[0-2] boundaries.
Fixes: 29f834aa326e ("net_sched: sch_fq: add 3 bands and WRR scheduling")
Reported-by: Coverity Scan <scan-admin@...erity.com>
Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
---
net/sched/sch_fq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 3a31c47fea9b..217c430343df 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -159,7 +159,7 @@ struct fq_sched_data {
/* return the i-th 2-bit value ("crumb") */
static u8 fq_prio2band(const u8 *prio2band, unsigned int prio)
{
- return (prio2band[prio / 4] >> (2 * (prio & 0x3))) & 0x3;
+ return (prio2band[prio / 4] >> (2 * (prio & 0x3))) % 0x3;
}
/*
--
2.34.1
Powered by blists - more mailing lists