Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18002674ybl; Thu, 2 Jan 2020 16:36:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyF0BPfwwhJuwFrtWDCbqUB/7q8Th63izXpUTNYz8tYNTfBNdGTdMC8O3hiszHWgzt9zq4D X-Received: by 2002:a9d:6511:: with SMTP id i17mr65914520otl.264.1578011761830; Thu, 02 Jan 2020 16:36:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578011761; cv=none; d=google.com; s=arc-20160816; b=plMAp4vyUNeN1D5tEGEEv5512YIlf4PIyFNzFKSwbqGd3vf5kyse8mWXo9iLEbXHI7 gv/rlsAIe0xGfgq+l2PB6M6EQfm9v5/hX3fBnq2sdMCq8j8T4e6fFBeln4edWJtbq3dV hD1lpNOq/QB1s7wy7AQVawepIuOimYGwlk6qDKuBZlvO4NfGVFh+bltFNIdvg9KTyt0x w04DXkUGKaELqvFXb+7k4gzlqvhlWIVKgZSbBLScicevPXwtdWBBzQKk7lLmHjqTzGW0 iR4Xfw2D6OIT693i/CVdzzVQe/A31ApSgva1Wcbk7O+OEB14o7OcarREZoAgUIjWobMH 7aRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=CcLu2FBhv8m4keJ+wkKhk/bX5rPS4x+Sd7AxPXXH634=; b=qq1ftLOla/vdF5ZkujUHwIeipGFLK/s35ISdifZawN1cZvYFM75ZSxb6/ajK1dloVC n+sf637ZP+RxglaWZ14okEWAWWAddgF/HeFJtkC8375VLwS8MtyWBi2OIQpfIJdqa/nc pCoFwkF/RKHgI38+oFA6BnoJ10sO6o9bCVAtQhWdiGkUPw309mdIds5LPBrLpiMl8WSh lDQvjBKLmfjgEEGlb+1xwIgkASe9GTY9hq70MVLwZ1kG2mcTmaH4yyKsAz4XRuXsyRvu zAAH+23nUurx830x5J1HbVWaXENdVmyvcZWc18JVgOCrTo5FfvDeRGM4zaFUjlMAD+A5 g1Mg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si27443456otr.140.2020.01.02.16.35.48; Thu, 02 Jan 2020 16:36:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726121AbgACAfJ (ORCPT + 99 others); Thu, 2 Jan 2020 19:35:09 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:56012 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgACAfI (ORCPT ); Thu, 2 Jan 2020 19:35:08 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:1c3::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 0F6AA1572A419; Thu, 2 Jan 2020 16:35:08 -0800 (PST) Date: Thu, 02 Jan 2020 16:35:07 -0800 (PST) Message-Id: <20200102.163507.404343273086201773.davem@davemloft.net> To: wenyang@linux.alibaba.com Cc: toke@toke.dk, ldir@darbyshire-bryant.me.uk, toke@redhat.com, xiyou.wangcong@gmail.com, cake@lists.bufferbloat.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sch_cake: avoid possible divide by zero in cake_enqueue() From: David Miller In-Reply-To: <20200102092143.8971-1-wenyang@linux.alibaba.com> References: <20200102092143.8971-1-wenyang@linux.alibaba.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 02 Jan 2020 16:35:08 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang Date: Thu, 2 Jan 2020 17:21:43 +0800 > 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. > > Fixes: 7298de9cd725 ("sch_cake: Add ingress mode") > Signed-off-by: Wen Yang Applied and queued up for -stable.