summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuya MAEDA <maeda-sxb@necst.nec.co.jp>2006-06-28 01:40:35 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-29 16:58:01 -0700
commit4ee303dfeac6451b402e3d8512723d3a0f861857 (patch)
treeb2a542ae60c29b58a4d9ef1dbd7d3d19af67554e
parent3d3a85337937bb5e3db676eeb4f3bf7f02533b44 (diff)
downloadlinux-3.10-4ee303dfeac6451b402e3d8512723d3a0f861857.tar.gz
linux-3.10-4ee303dfeac6451b402e3d8512723d3a0f861857.tar.bz2
linux-3.10-4ee303dfeac6451b402e3d8512723d3a0f861857.zip
[PKT_SCHED]: PSCHED_TADD() and PSCHED_TADD2() can result,tv_usec >= 1000000
Signed-off-by: Shuya MAEDA <maeda-sxb@necst.nec.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/pkt_sched.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 75b5b9333fc..1925c65e617 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -169,17 +169,23 @@ psched_tod_diff(int delta_sec, int bound)
#define PSCHED_TADD2(tv, delta, tv_res) \
({ \
- int __delta = (tv).tv_usec + (delta); \
- (tv_res).tv_sec = (tv).tv_sec; \
- if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
+ int __delta = (delta); \
+ (tv_res) = (tv); \
+ while(__delta >= USEC_PER_SEC){ \
+ (tv_res).tv_sec++; \
+ __delta -= USEC_PER_SEC; \
+ } \
(tv_res).tv_usec = __delta; \
})
#define PSCHED_TADD(tv, delta) \
({ \
- (tv).tv_usec += (delta); \
- if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \
- (tv).tv_usec -= USEC_PER_SEC; } \
+ int __delta = (delta); \
+ while(__delta >= USEC_PER_SEC){ \
+ (tv).tv_sec++; \
+ __delta -= USEC_PER_SEC; \
+ } \
+ (tv).tv_usec = __delta; \
})
/* Set/check that time is in the "past perfect";