Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stefan Hasko <hasko.stevo@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vimalkumar <j.vimal@gmail.com>
Subject: Re: [PATCH] net: sched: integer overflow fix
Date: Fri, 21 Dec 2012 16:11:35 -0800	[thread overview]
Message-ID: <1356135095.21834.8106.camel@edumazet-glaptop> (raw)
In-Reply-To: <1356130308.21834.8014.camel@edumazet-glaptop>

On Fri, 2012-12-21 at 14:51 -0800, Eric Dumazet wrote:
> On Fri, 2012-12-21 at 21:39 +0100, Stefan Hasko wrote:
> > 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 */
> 
> But this patch is wrong !
> 

Please resend your patch using something like

It will work much better.

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 */

  reply	other threads:[~2012-12-22  0:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 20:39 [PATCH] net: sched: integer overflow fix Stefan Hasko
2012-12-21 22:51 ` Eric Dumazet
2012-12-22  0:11   ` Eric Dumazet [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-22  1:04 Stefan Hasko
2012-12-22  1:16 ` Eric Dumazet
2012-12-22  8:03   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356135095.21834.8106.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hasko.stevo@gmail.com \
    --cc=j.vimal@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox