From: Nicolas Dichtel Date: Thu, 28 Apr 2005 19:14:37 +0000 (-0700) Subject: [PKT_SCHED]: Fix range in psched_tod_diff() to 0..bound X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7b3c63ac7cb5e2e6680727045aa35c2e5f1bace7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [PKT_SCHED]: Fix range in psched_tod_diff() to 0..bound Signed-off-by: Nicolas Dichtel Signed-off-by: Thomas Graf Signed-off-by: David S. Miller --- diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 87496e3aa330..7352e455053c 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -140,7 +140,7 @@ psched_tod_diff(int delta_sec, int bound) if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1) return bound; delta = delta_sec * 1000000; - if (delta > bound) + if (delta > bound || delta < 0) delta = bound; return delta; } @@ -156,7 +156,8 @@ psched_tod_diff(int delta_sec, int bound) __delta += 1000000; \ case 1: \ __delta += 1000000; \ - case 0: ; \ + case 0: \ + __delta = abs(__delta); \ } \ __delta; \ })