lkml.org 
[lkml]   [2020]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/7] Fix qdisc_watchdog_schedule_range_ns range check
Date
   - As all parameters are unsigned.

- If 'expires' is bigger than 'last_expires' then the left expression
overflows.

- It is better to use addition and check both ends of the range.

Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
---
net/sched/sch_api.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 2a76a2f5ed88..ebf59ca1faab 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -632,7 +632,8 @@ void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog *wd, u64 expires,
/* If timer is already set in [expires, expires + delta_ns],
* do not reprogram it.
*/
- if (wd->last_expires - expires <= delta_ns)
+ if (wd->last_expires >= expires &&
+ wd->last_expires <= expires + delta_ns)
return;
}

--
2.20.1
\
 
 \ /
  Last update: 2020-10-01 23:02    [W:0.628 / U:1.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site