Commit 7b3c63ac authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

[PKT_SCHED]: Fix range in psched_tod_diff() to 0..bound

Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89c8b3a1
...@@ -140,7 +140,7 @@ psched_tod_diff(int delta_sec, int bound) ...@@ -140,7 +140,7 @@ psched_tod_diff(int delta_sec, int bound)
if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1) if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1)
return bound; return bound;
delta = delta_sec * 1000000; delta = delta_sec * 1000000;
if (delta > bound) if (delta > bound || delta < 0)
delta = bound; delta = bound;
return delta; return delta;
} }
...@@ -156,7 +156,8 @@ psched_tod_diff(int delta_sec, int bound) ...@@ -156,7 +156,8 @@ psched_tod_diff(int delta_sec, int bound)
__delta += 1000000; \ __delta += 1000000; \
case 1: \ case 1: \
__delta += 1000000; \ __delta += 1000000; \
case 0: ; \ case 0: \
__delta = abs(__delta); \
} \ } \
__delta; \ __delta; \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment