diff options
author | Guillaume Chazarain <guichaz@yahoo.fr> | 2006-07-24 02:37:24 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-07-24 15:44:23 -0400 |
commit | 2266d8886f64c66e0a4e61e3e1c19dbc27ed00d4 (patch) | |
tree | 09666e27746a3aac8c00d6bfc3717939354888e1 /include/net/pkt_sched.h | |
parent | 4b79f0af48d529a360d3529def01835dc5d45fe1 (diff) |
[PKT_SCHED]: Fix regression in PSCHED_TADD{,2}.
In PSCHED_TADD and PSCHED_TADD2, if delta is less than tv.tv_usec (so,
less than USEC_PER_SEC too) then tv_res will be smaller than tv. The
affectation "(tv_res).tv_usec = __delta;" is wrong. The fix is to
revert to the original code before
4ee303dfeac6451b402e3d8512723d3a0f861857 and change the 'if' in
'while'.
[Shuya MAEDA: "while (__delta >= USEC_PER_SEC){ ... }" instead of
"while (__delta > USEC_PER_SEC){ ... }"]
Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/pkt_sched.h')
-rw-r--r-- | include/net/pkt_sched.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 1925c65e617b..f6afee73235d 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -169,23 +169,17 @@ psched_tod_diff(int delta_sec, int bound) | |||
169 | 169 | ||
170 | #define PSCHED_TADD2(tv, delta, tv_res) \ | 170 | #define PSCHED_TADD2(tv, delta, tv_res) \ |
171 | ({ \ | 171 | ({ \ |
172 | int __delta = (delta); \ | 172 | int __delta = (tv).tv_usec + (delta); \ |
173 | (tv_res) = (tv); \ | 173 | (tv_res).tv_sec = (tv).tv_sec; \ |
174 | while(__delta >= USEC_PER_SEC){ \ | 174 | while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ |
175 | (tv_res).tv_sec++; \ | ||
176 | __delta -= USEC_PER_SEC; \ | ||
177 | } \ | ||
178 | (tv_res).tv_usec = __delta; \ | 175 | (tv_res).tv_usec = __delta; \ |
179 | }) | 176 | }) |
180 | 177 | ||
181 | #define PSCHED_TADD(tv, delta) \ | 178 | #define PSCHED_TADD(tv, delta) \ |
182 | ({ \ | 179 | ({ \ |
183 | int __delta = (delta); \ | 180 | (tv).tv_usec += (delta); \ |
184 | while(__delta >= USEC_PER_SEC){ \ | 181 | while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \ |
185 | (tv).tv_sec++; \ | 182 | (tv).tv_usec -= USEC_PER_SEC; } \ |
186 | __delta -= USEC_PER_SEC; \ | ||
187 | } \ | ||
188 | (tv).tv_usec = __delta; \ | ||
189 | }) | 183 | }) |
190 | 184 | ||
191 | /* Set/check that time is in the "past perfect"; | 185 | /* Set/check that time is in the "past perfect"; |