netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sched: integer overflow fix
@ 2012-12-22  1:04 Stefan Hasko
  2012-12-22  1:16 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hasko @ 2012-12-22  1:04 UTC (permalink / raw)
  To: Jamal Hadi Salim, David S. Miller, netdev; +Cc: linux-kernel, Stefan Hasko

Sorry, I did not realize different sizes casting problem, now it's clear to me. Thanks for help.

Fixed integer overflow in function htb_dequeue

Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
---
 net/sched/sch_htb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0..51561ea 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
 	q->now = ktime_to_ns(ktime_get());
 	start_at = jiffies;
 
-	next_event = q->now + 5 * NSEC_PER_SEC;
+	next_event = q->now + 5LLU * NSEC_PER_SEC;
 
 	for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
 		/* common case optimization - skip event handler quickly */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] net: sched: integer overflow fix
@ 2012-12-21 20:39 Stefan Hasko
  2012-12-21 22:51 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hasko @ 2012-12-21 20:39 UTC (permalink / raw)
  To: Jamal Hadi Salim, David S. Miller, netdev; +Cc: linux-kernel, Stefan Hasko

Fixed integer overflow in function htb_dequeue

Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
---
 net/sched/sch_htb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0..1bd3faa 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
 	q->now = ktime_to_ns(ktime_get());
 	start_at = jiffies;
 
-	next_event = q->now + 5 * NSEC_PER_SEC;
+	next_event = q->now + (u32)5 * NSEC_PER_SEC;
 
 	for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
 		/* common case optimization - skip event handler quickly */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-22  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-22  1:04 [PATCH] net: sched: integer overflow fix Stefan Hasko
2012-12-22  1:16 ` Eric Dumazet
2012-12-22  8:03   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2012-12-21 20:39 Stefan Hasko
2012-12-21 22:51 ` Eric Dumazet
2012-12-22  0:11   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).