Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: Jonathan Morton <chromatix99@gmail.com>
To: Wen Yang <wenyang@linux.alibaba.com>
Cc: "Toke Høiland-Jørgensen" <toke@toke.dk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	cake@lists.bufferbloat.net,
	"Kevin Darbyshire-Bryant" <ldir@darbyshire-bryant.me.uk>,
	"Cong Wang" <xiyou.wangcong@gmail.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [Cake] [PATCH] sch_cake: avoid possible divide by zero in cake_enqueue()
Date: Thu, 2 Jan 2020 23:58:02 +0200	[thread overview]
Message-ID: <0750BA89-01A1-4126-9BEF-2C6AC607A5BD@gmail.com> (raw)
In-Reply-To: <20200102092143.8971-1-wenyang@linux.alibaba.com>

> On 2 Jan, 2020, at 11:21 am, Wen Yang <wenyang@linux.alibaba.com> wrote:
> 
> The variables 'window_interval' is u64 and do_div()
> truncates it to 32 bits, which means it can test
> non-zero and be truncated to zero for division.
> The unit of window_interval is nanoseconds,
> so its lower 32-bit is relatively easy to exceed.
> Fix this issue by using div64_u64() instead.

That might actually explain a few things.  I approve.

Honestly the *correct* fix is for the compiler to implement division in a way that doesn't require substituting it with function calls.  As this shows, it's error-prone to do this manually.

 - Jonathan Morton

  reply	other threads:[~2020-01-02 21:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02  9:21 Wen Yang
2020-01-02 21:58 ` Jonathan Morton [this message]
2020-01-02 23:34 ` Toke Høiland-Jørgensen
2020-01-03  0:35 ` [Cake] " 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

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

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

  git send-email \
    --in-reply-to=0750BA89-01A1-4126-9BEF-2C6AC607A5BD@gmail.com \
    --to=chromatix99@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=davem@davemloft.net \
    --cc=ldir@darbyshire-bryant.me.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=toke@toke.dk \
    --cc=wenyang@linux.alibaba.com \
    --cc=xiyou.wangcong@gmail.com \
    /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