From patchwork Wed Feb 7 15:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 870455 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mhJUvFii"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zc5W90m41z9s71 for ; Thu, 8 Feb 2018 02:55:01 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CDE1A1245; Wed, 7 Feb 2018 15:50:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EFC6D1234 for ; Wed, 7 Feb 2018 15:50:21 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9F0C83C4 for ; Wed, 7 Feb 2018 15:50:21 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id g17so481124pfh.1 for ; Wed, 07 Feb 2018 07:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NuorHimAf2diFwVkqP8pbu4CZau1rLHrI8f4IwlJE0E=; b=mhJUvFiifgHylwFiPB0d7l+ZbbiJInyQ879ieHLHo8bn8sxxlimAyiXPyyXEnW6h2P uCFNkyR5XGF1mMRI4K4Z7j8c5GFlt0OlxEeIeqXYQkSqmIgeAU9WABuKcPcp1BjamP/P oeItK/nRhr2/Ey/xZ9VrTFvdsh4b7pYK0oNMYAJMrNYfVS/NOyg2yjA1oPV/82eupsDL uKjMih/kmf9kxnlqNx1R4aCvBwwCi1zCpslUSY3himoL+xleeWAqCCPm21kEePKuLEM7 lTyPLvItid8O6M65okUd4wKZ04w5l4b9nMpZJtq8kU8lM1orfqnCZpHhRg45VsD7U0G7 Pdpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NuorHimAf2diFwVkqP8pbu4CZau1rLHrI8f4IwlJE0E=; b=YT+sWG0aSvnSlSPwZHypOgVdi5RCqkoqzICP+tu5AHpcbD6Bwz7HhjnEhG0jyv3DvA NXVWTp7r8FOKNasZX0aPdsYqUZsXfMKW+rkfdZhSCjd4cPqsu3AKEIqLAfH1iaro1gT6 BP5iQ8mWuHhNtDtcx8sWxBOiGG1OuR074TZxh3lhbozu+cN6xkvuMLB89Hmjygw7/nfP KLeWp2WjvL+X8qkCpbXNaC2qKtoaL2zMdKzfeG1BY77B//YaTxt5/3DkyocC84Exsnaq QIVQRQ6bmfXLqEQFAGxaLU8mImcgWsfYMbIOl376wzlTr+Uda3tMBtwJg3hLhCiaoQg/ XX1w== X-Gm-Message-State: APf1xPCmKsoh6YW35p4iynokYhrNvVmrN3U/FGlzuuUsQoFI/G5zn0S/ 0ulz935FA7WuQ6ROHalvAird/w== X-Google-Smtp-Source: AH8x226PKYwS7aiM8TjeSPuirPnS4EfUov5Yr+Tf7z+Fo406oYB2v6AgzqmB5uKtxzZEU8fDzsriIw== X-Received: by 10.99.111.138 with SMTP id k132mr5226640pgc.414.1518018620730; Wed, 07 Feb 2018 07:50:20 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id x15sm4924096pff.55.2018.02.07.07.50.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Feb 2018 07:50:19 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 7 Feb 2018 07:49:58 -0800 Message-Id: <1518018601-31980-9-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518018601-31980-1-git-send-email-gvrose8192@gmail.com> References: <1518018601-31980-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: "Gustavo A. R. Silva" Subject: [ovs-dev] [PATCH v2 08/11] datapath: meter: Use 64-bit arithmetic instead of 32-bit X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: "Gustavo A. R. Silva" Upstream commit: commit 5b7789e8fa8f353ad8f2c44de2385cb161b22d32 Author: Gustavo A. R. Silva Date: Tue Jan 30 22:55:33 2018 -0600 Add suffix LL to constant 1000 in order to give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type long long int (64 bits, signed). The expression (band->burst_size + band->rate) * 1000 is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1461563 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller Signed-off-by: Greg Rose --- datapath/meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/meter.c b/datapath/meter.c index d36870b..f9e8f12 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -498,7 +498,7 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb, long long int max_bucket_size; band = &meter->bands[i]; - max_bucket_size = (band->burst_size + band->rate) * 1000; + max_bucket_size = (band->burst_size + band->rate) * 1000LL; band->bucket += delta_ms * band->rate; if (band->bucket > max_bucket_size)