mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net_sched: red: Avoid illegal values
Check the qmin & qmax values doesn't overflow for the given Wlog value.
Check that qmin <= qmax.
Fixes: a783474591
("[PKT_SCHED]: Generic RED layer")
Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5c47220342
commit
8afa10cbe2
5 changed files with 22 additions and 0 deletions
|
@ -168,6 +168,17 @@ static inline void red_set_vars(struct red_vars *v)
|
|||
v->qcount = -1;
|
||||
}
|
||||
|
||||
static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
|
||||
{
|
||||
if (fls(qth_min) + Wlog > 32)
|
||||
return false;
|
||||
if (fls(qth_max) + Wlog > 32)
|
||||
return false;
|
||||
if (qth_max < qth_min)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void red_set_parms(struct red_parms *p,
|
||||
u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
|
||||
u8 Scell_log, u8 *stab, u32 max_P)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue