Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1293044ybe; Mon, 2 Sep 2019 18:23:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnr7KgqSIoysz2CQjfR/YRfGtH6RbWTR70qqJPB6tLOHBEe0ZQEDnW6ertc+gbKZ6Xnij1 X-Received: by 2002:a63:40a:: with SMTP id 10mr28116311pge.317.1567473832968; Mon, 02 Sep 2019 18:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567473832; cv=none; d=google.com; s=arc-20160816; b=FYRWfc46OxYLzh0WIKYqrcdb2ucBs7odLoQ5ulf/COllpljodDCOQGcJ/AVErCBqBA HWN4/V+w3jBM3CopXRbOzO2w5NNJg5qCScp3VFkmQL0KMiwDZM1eeyi/dy39HUPXdS8H XEBvpj9OcrNSwSiC6wmn3n9KJxpM2B/nGNSffJXPfzBCpGI1MGbUz5mkQpsKHycecjfU 66wCf/w7kNtYFvC8+zeIFdxqvmqGqDwMPl+wRjWu3EhF9mc/VgtOLzekg/Kcauy3MHmM UQHEqCpobhK5SJ0ixatwB/20NXw1guoEFtqtk786XR+JFccK0gZ1EVUPBnbvAsaVM7Vy hPBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=r8YPUUF0d88Im2MSWVp9Z/JOWe6kwDxp6YPzU+SjyHg=; b=h2kCvtXw3IjbtLSpi9ftcmvtRj5z9dbQlfSK4qj9KBMUatpd2h9z6+vmL6xJc1sYS+ AE9Ogmm9+5gsR0RO82bGjamjwXdnGqBAN+sK601afu5ndGrv0v62F+KeqHQ7ouedTu7c NUw0xyLdQzw2SIs9TbzUnMs4aVL1Rz1a4eUITy3nT9GVrrL532V0aI9wLRwMGOiU8F2Y c+K1mvxeTw3TOK5ancG7mg9uxGe8Z6AS3TXKYE7GDv464CYIJwM4TQ5sim2Vr+8MCoKL Dusm6BDaKZzddsYiJbBEoMbP4cBOsbkrh+IXxHDY/PrhqrYkTFeFhmOMMNavzfX/n3ZH 32zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FMvvFFMK; 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 f4si4699005pjq.37.2019.09.02.18.23.37; Mon, 02 Sep 2019 18:23:52 -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=pass header.i=@gmail.com header.s=20161025 header.b=FMvvFFMK; 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 S1726465AbfICBUV (ORCPT + 99 others); Mon, 2 Sep 2019 21:20:21 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:45175 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbfICBUU (ORCPT ); Mon, 2 Sep 2019 21:20:20 -0400 Received: by mail-ed1-f67.google.com with SMTP id f19so2996792eds.12; Mon, 02 Sep 2019 18:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r8YPUUF0d88Im2MSWVp9Z/JOWe6kwDxp6YPzU+SjyHg=; b=FMvvFFMKS1ZonpEVgVVCgnhfhzSmho1H03hppgHDZ5V9kA+PcZhPyRl7WWIC0ZJwqi 8fe9MU6N65UYdMEj3vP1UO277huHHf/uKFV1TVqCcNPBrCU172UI3Rtd2PmnYWgVtLuc e/Pi7CRiCxbC07HHOp9p/IEXdjIU1LV0KcUdNLjy2fGQ82Hr9z+M3ovWZpITZeLbRhBf +dl+cuge5vW06Ujtph9TIBcvMuPVnudvxPhtQXxtQPtQ5MsSt5kMXG2HpXItZFyBmkG9 Zy7MEO+Qc1vKiK9QxQl0BPrrthcrL1tv6SebQQ6iKHnFaUoqIhmsObfUHBDy6BXwNe77 9iLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r8YPUUF0d88Im2MSWVp9Z/JOWe6kwDxp6YPzU+SjyHg=; b=lo5D1KJjMZXjDHIkDeex36TRLsfQ4x9mV8s3CLPIrKeRYtK1eR8ZNESZkuYJwOxIBL lqUNjfo4sonyKuJwhU1vRmckYjwkZvaREPleRSO1Dproav/Rzd69PYg8MfKcgR0tA2AL IAk3v5tKWiXOO6G8eHPQC9ynCkIGgVdA1weuDzqkmLZlBtwmaufVsnpFYPjahH24M/Dr ytNiZrY06gEKy6l6DgistDoGEEn0GTKTuwM3khsqcRp9BV6EmWmanYeo8vT3ssu4h517 mRUtnNtGre/NUhW+yYBTtY1PCA4p1AC3ubcFZbZy73L4OumGar2NMkhPiKB6zdekRpvJ oPQQ== X-Gm-Message-State: APjAAAX/dBccMc5hbEGY6Ubi3V9Z+CHkf0zBZ6aSl1vTKrz96tN0sken A3dPR0JN/JT7Ga5LnNqOFLiPtbuWXBMm/5vsF4Q= X-Received: by 2002:a17:906:b34a:: with SMTP id cd10mr5454993ejb.300.1567473618872; Mon, 02 Sep 2019 18:20:18 -0700 (PDT) MIME-Version: 1.0 References: <20190903010817.GA13595@embeddedor> In-Reply-To: <20190903010817.GA13595@embeddedor> From: Vladimir Oltean Date: Tue, 3 Sep 2019 04:20:08 +0300 Message-ID: Subject: Re: [PATCH] net: sched: taprio: Fix potential integer overflow in taprio_set_picos_per_byte To: "Gustavo A. R. Silva" Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , netdev , lkml , Vinicius Costa Gomes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Sep 2019 at 04:08, Gustavo A. R. Silva wrote: > > 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 > --- Acked-by: Vladimir Oltean > 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 >