Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1282636ybe; Mon, 2 Sep 2019 18:11:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXuMddhy4QLlWil3Vui9qhfZ4sPwaN3Jx+SBqFT1cNGXH89+R0mflgJUjDCmT1tAaPsGYo X-Received: by 2002:a17:90a:ba85:: with SMTP id t5mr15082049pjr.26.1567473079010; Mon, 02 Sep 2019 18:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567473079; cv=none; d=google.com; s=arc-20160816; b=ZF8YwO/9CB0a2hjqVYaYONypjtTHHeTFEcLL5/V/8tuaK0SxYW5Pfm6a8uv08n0ShA 5SmVtF7EFC6jxCLDxOPQz5QFQsB8bz7RyiVksJ7MPbiN06mMn+5V6JRYNTAbwSd+v7w7 Qld8aab45u64F9EZ+Lr/MvdeIjSN8hz6vmDuxfkjkjxFXyGU1xPkuQOyLjAHWHRzxsIN jm16aTU6kipW34JdOUoeUl+xZWtmQI8IB/5ySy0ZT3p1F6nPAyKy7L/eJR6A8IenI59z 6BncGZ69XoXe1C9kpQBTvJ+HvmVkUrSaOsXj2wxID+Y6UY2m2ActYSH23fc6v9YFhQ2d W87Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=IPXpQjejrqZ52pjbtbF1TXRKNnTxNBlTRR+B1eBDFS4=; b=b/9lYxfONhQOPfvKY/vqY2ifmX/GLJ8hcWeVBAqMPSldtTxzKcw2FdMUxAtdjVkGWS MJFgKPwNwlPml0bvTQHEpbdZp97wJXpms6iYqpsoAiThEpdnml4hHAF73L8ayX4V2jXN uBHjmEUs8lyYa/Oqa+nM1EBeTSPMrucI1tzj8AvNLFpn6s7MN34U+KppBFHX8RwEl8Fk LsoR7/Jej6kvk1ohJuuY0bRhvtA0Yz+OJOq6CEoQ5in1lUKCeafMkdVptuZO2VA78VFu ssF4b8tsW/veQAk9MHBfHqa5PzSF8kAH/K5sDi66703yjC064JHmYvKgjy3Omq9whcVp KVqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=NggBeGRR; 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 w20si13127826plp.369.2019.09.02.18.11.03; Mon, 02 Sep 2019 18:11:18 -0700 (PDT) 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=fail header.i=@embeddedor.com header.s=default header.b=NggBeGRR; 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 S1726270AbfICBIV (ORCPT + 99 others); Mon, 2 Sep 2019 21:08:21 -0400 Received: from gateway23.websitewelcome.com ([192.185.49.124]:16947 "EHLO gateway23.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfICBIU (ORCPT ); Mon, 2 Sep 2019 21:08:20 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id C8F764B70 for ; Mon, 2 Sep 2019 20:08:19 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 4xIxiFyJF3Qi04xIxiuJMH; Mon, 02 Sep 2019 20:08:19 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Type:MIME-Version:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IPXpQjejrqZ52pjbtbF1TXRKNnTxNBlTRR+B1eBDFS4=; b=NggBeGRRGpw5drYbZbu6G1smfC 9Z1ZTY75tiynbOHUZ1oFqX2WQnDVAGQx6cqNIgciH6dnIxALTY3m6gv+1KCjASWFOJj1/39Ta2Nzc Se0lFwg9cBX36Jv4xV4sRvWrIZuOMCoZQGaSvX+uMBadeiQjIaDH7TSKxyQwsdKn6DStD6EnbVxpz RZbQs/YFYrnCTEVe/Z51Lc3hYgmFFyD5tuhvl24zAx/xa8jGaRGSyb5neNRGI440Js62Ini1cYUnQ St34WaTw0GRZTpxYXqXEn2KYa/6AUSo/W4eFLHmwvELlL2ZR0FSHxlUxG5dsYwSD3/FRFfZqPu0P4 ri16SXyg==; Received: from [189.152.216.116] (port=44906 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.92) (envelope-from ) id 1i4xIw-0011oi-Kr; Mon, 02 Sep 2019 20:08:18 -0500 Date: Mon, 2 Sep 2019 20:08:17 -0500 From: "Gustavo A. R. Silva" To: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Vladimir Oltean Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] net: sched: taprio: Fix potential integer overflow in taprio_set_picos_per_byte Message-ID: <20190903010817.GA13595@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.216.116 X-Source-L: No X-Exim-ID: 1i4xIw-0011oi-Kr X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.152.216.116]:44906 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add suffix LL to constant 1000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is being used in a context that expects an expression of type s64, but it's currently evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1453459 ("Unintentional integer overflow") Fixes: f04b514c0ce2 ("taprio: Set default link speed to 10 Mbps in taprio_set_picos_per_byte") Signed-off-by: Gustavo A. R. Silva --- net/sched/sch_taprio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 8d8bc2ec5cd6..956f837436ea 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -966,7 +966,7 @@ static void taprio_set_picos_per_byte(struct net_device *dev, skip: picos_per_byte = div64_s64(NSEC_PER_SEC * 1000LL * 8, - speed * 1000 * 1000); + speed * 1000LL * 1000); atomic64_set(&q->picos_per_byte, picos_per_byte); netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n", -- 2.23.0