Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17879553ybl; Thu, 2 Jan 2020 13:59:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwtGgiCSpw3ZTXi0psCblJn0rTE/o1OWe5KNZQhbx3fgGISQ4tXrmgF24Eg/65M3VV+J4PL X-Received: by 2002:a05:6830:1d6a:: with SMTP id l10mr96929739oti.233.1578002343538; Thu, 02 Jan 2020 13:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578002343; cv=none; d=google.com; s=arc-20160816; b=Ji1P5OJ1qDstBMz/x05Wc6diaQxmPZt7P85cGWg29DLPUVUgmepUWEbS/AKbnZXn+f ijl6CEpHoTQiywFYoyOHsuxuKySWoDegOtAMm99WpM7dWWhBj+XIVEabov3zt2wqENiv UbE5Iihxkq/D1nafhmGlo4YytFaBmIOOa/scXSsiM0VyfyHixdrYU4ekw3oSnPf+CPYC yXBFCvAfPSJsVn1KMpptyQvd6U8NmmG+mRI+MoMgbeICxqFJCMvOd8KnZN11DfTaEOBA r6o4UYiigaV6z6hl+cs+XHEPl2vusbd1fEhCGn4Lww5vu6OrA8wB22EimO2xqkmjj8TA BRvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=35q6Jfi2CC23jXWt4F+Y2RbWyKxhwN9lDjJC7r78ZIs=; b=JNS780bI6bPBceYV3rYKm9AJLhegBDww62ZIN4MFO3Wcbt+MR2OaJaBFNUJrTnb08H AizpKEsBuk6aLxaaKMfU1qzOQM9MuYCNtdusRqu6xdg2w9nalHjTPCKvVK08qAuhmEyw zHdcX/kA+sM2t1VWuLJQXDV17fKqz+VU8hBtrWCzplsoZ59GIAM0T0qGhfoZJBITz//O oADeDXN7+HrD/IrTOEZGU1y93rbs4iuVDwdueH6waAzZs8gifk6EPigaV+5dbfxONScl khbvpe5WyY1unm5HmCZiiwoz1KyoECwiltzBnGU/VbmNxPncHmtV/L3dP/Yt8sSO1fqz KIVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vMMuuA9l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si23244729otj.148.2020.01.02.13.58.51; Thu, 02 Jan 2020 13:59:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vMMuuA9l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbgABV6I (ORCPT + 99 others); Thu, 2 Jan 2020 16:58:08 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36820 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbgABV6H (ORCPT ); Thu, 2 Jan 2020 16:58:07 -0500 Received: by mail-lf1-f67.google.com with SMTP id n12so30759736lfe.3; Thu, 02 Jan 2020 13:58:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=35q6Jfi2CC23jXWt4F+Y2RbWyKxhwN9lDjJC7r78ZIs=; b=vMMuuA9l9972ihHdc7hjdkhsUVFWoxUnVs30y5dRjb3CjWQx9INuW//pxcQsuPE3lK Qs5GuIuqd652A0/gkHUbVATgkvp+BBRr99JZEmO00EZzL5OhL8yhYWuRwYnAJ7B1JKsa L+JcjINjfBEmT57PMS2GroCkEB98e8ZJW5a3Sj8ySANKrEra0SoIwIlBU1jMMG1/ASQ5 FulOqXC4EGJf8f7vUmi1EA3uyutDHPMdRRLljmIKD13XEzZmnicUFeo6fsqXIOZUr2pq JtQ+EGKef/UYlcc5aSKTtSUtwKgqjtnOR7mNL7uh6TEakjx0EkK5/P9FBdo+353rQVUc MOaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=35q6Jfi2CC23jXWt4F+Y2RbWyKxhwN9lDjJC7r78ZIs=; b=kCDe4SdOYQc6rtrtIyxa/UtIbyp13NxElF1cwWl58dLCy9D6n1QLSTQCpdBgKy6M/q LMIZSfCAhKXvzADUZbKtmSIgx/PR0DAnk1/q/ZbJbXAX7knPR3VW3O80cecQuq9mdyoO +h9z4QHtn2NcjKFENZsWvImc05ksHpIJNFrpBiCaRMLhhA4jg5LLlOXnvrLyo7k4WSW4 Fy4pmwKRiB3tWMLO2DKxSl1IL43pFMk86b/azQyvy7+n2w0WYc+sIRlbSRMNLhjUiovB PO/iEdWt4bcke/HbvfNYSsHNFs7L4mja3PQ7H542b3VSukMqsD5bd3tnzhEeWEMlz3Rr +abw== X-Gm-Message-State: APjAAAWt3E26J1ZuiGuBxQdJPFBYP28nGHMEjxD3Ao3owN3HctcbgvPH O31NmQTKJ8/HbjqExfZK6cMK0yGlurE= X-Received: by 2002:a19:6a06:: with SMTP id u6mr48503903lfu.187.1578002285376; Thu, 02 Jan 2020 13:58:05 -0800 (PST) Received: from jonathartonsmbp.lan (83-245-229-102-nat-p.elisa-mobile.fi. [83.245.229.102]) by smtp.gmail.com with ESMTPSA id p12sm23687003lfc.43.2020.01.02.13.58.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jan 2020 13:58:04 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [Cake] [PATCH] sch_cake: avoid possible divide by zero in cake_enqueue() From: Jonathan Morton In-Reply-To: <20200102092143.8971-1-wenyang@linux.alibaba.com> Date: Thu, 2 Jan 2020 23:58:02 +0200 Cc: =?utf-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, cake@lists.bufferbloat.net, Kevin Darbyshire-Bryant , Cong Wang , "David S . Miller" Content-Transfer-Encoding: quoted-printable Message-Id: <0750BA89-01A1-4126-9BEF-2C6AC607A5BD@gmail.com> References: <20200102092143.8971-1-wenyang@linux.alibaba.com> To: Wen Yang X-Mailer: Apple Mail (2.3445.9.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 2 Jan, 2020, at 11:21 am, Wen Yang = wrote: >=20 > 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=