Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17962727ybl; Thu, 2 Jan 2020 15:44:17 -0800 (PST) X-Google-Smtp-Source: APXvYqz0nTX8FGLBqEpm71fv7M+A/0uFL3zVQLlSSZwdnN8d57lV2y+RJaPOABr8Ky3kvAEeRkjh X-Received: by 2002:a54:4085:: with SMTP id i5mr3302817oii.17.1578008657303; Thu, 02 Jan 2020 15:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578008657; cv=none; d=google.com; s=arc-20160816; b=qixahlt3qessxv5MaY5z/oMZGSSV3Z/wvHJLF4WaiwINI05J7Brw0HG/zRD7cdSONh DIpe+ITfg+lP2I2Mx11zGMbFKJlwnKuXH2aBQuO0ztQVEMY/2lBnXFQ/iBQq6JLrXNQ7 5aa3luQ61A2fvUjaKyYDgUlh8RBo49khg+ZWtbbDsuPlmoV7mJNyr1oIks9a+sm9uAxD f8VBj8W6m9P9q6kvQ1hANs3JxmHs6fyV7f02+hinNzZlBVqF/ce7wBMrv3ww7syThVFI JTYjKm2t2PgwM8YFVX+KAuBH0qW12eNk+aTFTG74/L2xa3fmc9JG4DG6liuS5puOwltt rLqg== 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 :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :from; bh=n+/Z2y8RBVuqOI4GbqxFKUrx0mw1L0vQ5v5oMAmp7p4=; b=wj9GdAM2x2KOR6NixyNn3VsBKKhODle240afFu1kNXnFMd1lWepMh9w0rIAWyrdLeC yaY4ObyYTd0mdPAYDl68Nw3FGV2JVvwBCCePtZlJCtaMjNxoHMBxYA+1YOMTXNABHVos EuFHgVkXHXtVAGmHDjvsWpKRd97f9N8MQWjK+Bj28kIqxn8mvNRqPxW+lBHLvJR3PYtJ buHwDQJ8OMYKgNsI15U1vzIY2AW0nLZrgEpclXC8Ln/YTjBTnuHM003lcwoTgw7QFEmv T1+WZgtvVNIu893ubvmG2Gp8vvISQZrpJjni55koazstdZBvvJlkv639AJBZexm/GxUy coHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=LoYd6qXD; 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=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f194si27511784oig.243.2020.01.02.15.44.05; Thu, 02 Jan 2020 15:44:17 -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=@toke.dk header.s=20161023 header.b=LoYd6qXD; 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=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbgABXnK (ORCPT + 99 others); Thu, 2 Jan 2020 18:43:10 -0500 Received: from mail.toke.dk ([45.145.95.4]:47027 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgABXnH (ORCPT ); Thu, 2 Jan 2020 18:43:07 -0500 X-Greylist: delayed 540 seconds by postgrey-1.27 at vger.kernel.org; Thu, 02 Jan 2020 18:43:06 EST From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1578008042; bh=n+/Z2y8RBVuqOI4GbqxFKUrx0mw1L0vQ5v5oMAmp7p4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LoYd6qXDE5xAkgF2bwCD0T2jgTeox5j6DXM1M6YwSyyiIgC4s339InEiSQ+Ii9jEw E/03m4wW582/wfubbb5xghNEIY440TWkImjxPtKQrS6bPV43ssXEJz79HyoCtFA0WK jlfLzgl6Z20tN8ZdeNSgcyZ1/x6xf7f3uIaaVXk3NEZusaBYY0md3LnksEl/c9zV70 i/XJP7w99sQRz/7o9Yh13kZtpl3ESq50+BRdyRlwZ71fN7M7Lk0O8hfCnNSWVjXgxm 47uMNKSNCrYZujafjMO1cDRwfakGV3N9FBOiYwzlyQDfk4vxrFT8wJb2goOueaRRPk /3EEhSnY9xDCg== To: Wen Yang Cc: Wen Yang , Kevin Darbyshire-Bryant , "David S . Miller" , Cong Wang , 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() In-Reply-To: <20200102092143.8971-1-wenyang@linux.alibaba.com> References: <20200102092143.8971-1-wenyang@linux.alibaba.com> Date: Fri, 03 Jan 2020 00:34:01 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87ftgxl9g6.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wen Yang writes: > 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 > Cc: Kevin Darbyshire-Bryant > Cc: Toke H=C3=B8iland-J=C3=B8rgensen > Cc: David S. Miller > Cc: Cong Wang > Cc: cake@lists.bufferbloat.net > Cc: netdev@vger.kernel.org > Cc: linux-kernel@vger.kernel.org Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen