Jesper Dangaard Brouer
1ba3aab303
net: codel: Avoid undefined behavior from signed overflow
...
As described in commit 5a581b367 (jiffies: Avoid undefined
behavior from signed overflow), according to the C standard
3.4.3p3, overflow of a signed integer results in undefined
behavior.
To fix this, do as the above commit, and do an unsigned
subtraction, and interpreting the result as a signed
two's-complement number. This is based on the theory from
RFC 1982 and is nicely described in wikipedia here:
https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
A side-note, I have seen practical issues with the previous logic
when dealing with 16-bit, on a 64-bit machine (gcc version
4.4.5). This were 32-bit, which I have not observed issues with.
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-04 20:01:29 -05:00
..
2013-09-11 12:34:13 -07:00
2013-10-07 15:40:44 -04:00
2013-09-23 16:29:41 -04:00
2013-10-17 15:13:20 -04:00
2013-04-08 17:16:57 -04:00
2013-11-04 19:46:58 -05:00
2013-10-21 18:43:02 -04:00
2013-08-14 01:12:58 +02:00
2012-06-17 16:29:38 -07:00
2013-11-03 23:04:57 -05:00
2013-07-31 17:24:22 -07:00
2013-09-28 15:56:15 -04:00
2013-07-31 17:50:01 -07:00
2013-08-10 01:16:44 -07:00
2013-07-27 22:14:06 -07:00
2013-07-31 17:50:02 -07:00
2013-07-31 17:50:02 -07:00
2013-08-28 17:45:48 -04:00
2013-09-26 13:27:13 +02:00
2013-11-04 15:27:08 -05:00
2013-10-19 18:55:42 -04:00
2013-09-05 14:54:29 -07:00
2013-11-04 20:01:29 -05:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2012-04-05 05:08:04 -04:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2013-09-20 14:49:32 -04:00
2013-01-09 23:59:53 -08:00
2012-07-19 10:43:03 -07:00
2013-10-23 16:49:34 -04:00
2013-10-29 06:39:42 +01:00
2013-09-20 14:49:33 -04:00
2013-03-26 12:32:13 -04:00
2013-10-03 15:36:37 -04:00
2013-09-20 14:49:33 -04:00
2013-09-20 14:49:33 -04:00
2013-09-20 14:49:33 -04:00
2013-09-20 14:49:33 -04:00
2013-10-19 19:36:18 -04:00
2013-01-27 22:46:33 -05:00
2013-09-20 14:49:33 -04:00
2013-07-16 09:58:05 +03:00
2013-04-08 12:00:16 -04:00
2013-10-28 20:07:50 -04:00
2013-09-21 14:01:38 -04:00
2013-10-19 19:45:34 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-05-28 23:49:07 -07:00
2013-10-23 17:01:41 -04:00
2013-10-08 23:19:24 -04:00
2013-10-19 19:45:35 -04:00
2013-10-17 15:56:53 -04:00
2013-09-21 14:01:38 -04:00
2013-10-09 13:04:03 -04:00
2013-11-04 13:48:30 -05:00
2013-10-23 16:49:34 -04:00
2013-09-04 00:27:25 -04:00
2013-09-21 14:01:38 -04:00
2013-10-19 19:36:18 -04:00
2013-10-15 10:36:01 +09:00
2013-10-09 00:01:25 -04:00
2013-10-23 17:01:40 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:39 -04:00
2013-09-21 14:01:38 -04:00
2013-04-29 15:41:56 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2013-10-02 18:18:23 +02:00
2013-10-21 18:56:23 -04:00
2013-09-04 14:53:20 -04:00
2013-10-01 17:06:14 -04:00
2013-09-21 14:01:39 -04:00
2013-07-31 17:50:02 -07:00
2013-10-14 18:00:59 +02:00
2013-09-21 14:01:39 -04:00
2012-09-17 18:08:54 -07:00
2013-09-21 14:01:39 -04:00
2013-09-05 14:54:29 -07:00
2013-09-21 14:01:39 -04:00
2013-09-21 14:01:39 -04:00
2013-09-23 01:51:07 -04:00
2013-07-31 17:24:22 -07:00
2013-08-31 00:32:32 -04:00
2013-09-23 01:51:08 -04:00
2013-09-23 01:51:08 -04:00
2013-09-23 01:51:08 -04:00
2013-09-23 01:51:08 -04:00
2012-04-16 23:53:11 -04:00
2013-01-03 13:01:30 +01:00
2013-10-10 00:08:07 -04:00
2013-09-23 01:51:08 -04:00
2013-10-17 16:11:04 -04:00
2013-09-23 01:51:09 -04:00
2013-09-20 14:41:02 -04:00
2013-09-23 01:51:09 -04:00
2013-10-01 17:06:14 -04:00
2012-08-06 13:40:47 -07:00
2013-10-23 16:15:01 -04:00
2013-09-23 01:51:09 -04:00
2013-10-21 18:43:02 -04:00
2013-11-04 19:57:59 -05:00
2012-06-09 14:56:12 -07:00
2013-06-04 16:43:42 -07:00
2013-10-08 16:27:33 -04:00
2013-09-23 16:29:40 -04:00
2013-07-27 22:14:06 -07:00
2013-10-29 02:39:13 -07:00
2013-09-23 16:29:40 -04:00
2013-09-23 16:29:41 -04:00
2012-05-16 15:17:08 -04:00
2013-09-23 16:29:41 -04:00
2013-10-09 13:16:36 +02:00