Received: by 10.213.65.68 with SMTP id h4csp2118627imn; Sun, 8 Apr 2018 20:10:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/xoEs+eTsm7Z+2W5o/SbrHDsmJn1sxtFvfG7rCiUXHLfO4L6fGNAjMfHumSFB2fMcAFxu0 X-Received: by 10.167.134.80 with SMTP id a16mr9887098pfo.172.1523243402112; Sun, 08 Apr 2018 20:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243402; cv=none; d=google.com; s=arc-20160816; b=I+wNjukeWs+OqnTdBfH7J4GHgd5YuT+YIPnShapw6BsEfMtT2mMSUULZ4+ge6tJ+wP kUSsT5RLjI54fb1yP4W86AoTu+XzT7m/19KMRLqdgKLWAmN7wvVGWeRzYzLTYl3gvMZS N/yCx/YLqKrAVX6nauyssMYylNDqWS1Q9iVPIOO4onsAbWdCjAR+l4Yr0CqY/KFvX7r/ HrRnlzodQ6zsWD85J5CUJDhaC9NlBs+junePUIBBhlJG45UnVhCX9jqsb5Q2prTgxKQY e/1I8BcUNR46muVL7LChxbUE73OeVFY0YPBWTOpJTXnWBYR5r0GSfbzq2g+qDXn8fvcx FFPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=N8lRbqw7JBPRaeu91F1CymaiZdzzUEzlL3D41wOd5/o=; b=1KffgJsDJAet02bdaPtVxbjgxLgTeGt1cgKxJBSxQMoCq7jHpsxhMML7X/pI6g+0yQ uFA2/rtSuQZSl8vWgK5mxRU/0GTPBnfs4JXkWwBpd/MxW5I1OTV9SZhR8ZatTBMZmkyc ZDYV83ClHC19xFwpUR7uxtHNZIDuau3zIe8D2FFFgpVdNUpoVA9qHDOdLw8PjzUoTZUE +Gz+0gUomS2/sW+DYhLNi9hWtTg73pkN1jiTElimBdxeutf0+9tDQTLCNnRZAb4VNelI aKbMCIAGQCE1zkBY2el/qOuq40w1H6dDHED3KuxujlvU33fyuE+RXjau1dZf5DGnp9Wx vIqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Q7rYNKri; 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=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r79si12003814pfb.149.2018.04.08.20.09.24; Sun, 08 Apr 2018 20:10:02 -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=@microsoft.com header.s=selector1 header.b=Q7rYNKri; 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=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757480AbeDIBvU (ORCPT + 98 others); Sun, 8 Apr 2018 21:51:20 -0400 Received: from mail-by2nam01on0130.outbound.protection.outlook.com ([104.47.34.130]:18358 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932337AbeDIAdu (ORCPT ); Sun, 8 Apr 2018 20:33:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=N8lRbqw7JBPRaeu91F1CymaiZdzzUEzlL3D41wOd5/o=; b=Q7rYNKrikLgAJKRXE4ETLj7JWrkFq/I24PxRsjT/UMXC0FsoEQlPuaYtY3AFNfefSFXugZwbLscidURZUb/uhU//9wygOn06k5JPSipp142HM4XhiXrfKjaZ5cDI4vyml+3+JAzTNkBHkcXmQxVwV6czGnqzWeAJ178ikrJ5Sak= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0806.namprd21.prod.outlook.com (10.167.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:33:48 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:33:48 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "Gustavo A. R. Silva" , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 252/293] tcp_nv: fix potential integer overflow in tcpnv_acked Thread-Topic: [PATCH AUTOSEL for 4.9 252/293] tcp_nv: fix potential integer overflow in tcpnv_acked Thread-Index: AQHTz5lbD6h6XD8nZUu+KDXJgIOJCg== Date: Mon, 9 Apr 2018 00:26:08 +0000 Message-ID: <20180409002239.163177-252-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0806;7:9E9UIMG7efc5P1YrckQ1OVpApQc6ah+hIaKgv8pmSf7+7xTgwAaXSVLyplU1dKhR2tSYD7Xy+lSHNSRN8PwFxDzldbZav2rTuX+YhSd/wbj5SXYNl6a0XuEcgEEoM2SIIZu8eRlnPHw/0A77T4HjS8i6dwAKcVmFq3ik6mntFB4p5FUTmpf+GHwTaMnTk28oJdS+lTbgFiBP17YHhTV4rNdzATchk6+wKUO37EnVNYgL27LCPJlF22z2u1Q9ejt5;20:PxOO8IriLI8wivPGWHRK/qB/23aTHDnbj3RXkkLvQZtUMkhQSx/7RGE/RpY3bi7SqOGG2hko0cw3+Q9woosAGPB18EhY0iAfsgwvRFBWEG5JvpBwBH4/c0DQiBkQArEiH6cVkTdU8VfyIlLYSQZExIqZwk0qiD3FocfkO0mzZVs= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 50875444-2038-4ef5-e225-08d59db18f36 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0806; x-ms-traffictypediagnostic: DM5PR2101MB0806: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0806;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0806; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(39380400002)(199004)(189003)(2906002)(25786009)(2501003)(10290500003)(476003)(11346002)(446003)(97736004)(5250100002)(68736007)(2616005)(102836004)(6506007)(59450400001)(3846002)(3660700001)(486006)(3280700002)(305945005)(6666003)(99286004)(5660300001)(76176011)(1076002)(186003)(26005)(7736002)(6116002)(81156014)(81166006)(86612001)(4326008)(105586002)(10090500001)(2900100001)(54906003)(22452003)(316002)(36756003)(110136005)(107886003)(8676002)(6436002)(478600001)(53936002)(66066001)(6486002)(6512007)(86362001)(14454004)(72206003)(8936002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0806;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: k3wX0z7VDg3nc8oSJLoiFWOwM0XMgb/UCgJ+02ltEUyOrQNnCri6UMPQhxL5HJ3YQVVyXJ10IDdrsf7rqUHw45PJBVS9jC+36Zvb1CKLmfqyAbEPPBCqcDIAnOQd62iMVG5UQ19T86m0QRFki53LdFMSCjTf8mYrLGsOK58+VITjLz7Qe1KkD581aa15s1uvrAl2j5exXP4ojXiBeo21Gu7wLiRg075Q5tGOf9/DvZ6TXqATPcC0QNRsY8iP6V1XgEyb7isNSWmC20/riBjmmWDfDY53IJjuo6/KYd1+9dWlNGoLcqDQ/bjFosMxf50d9l62MVNQa/kxCKWSPE7zDGhgHkPxLshOPRjb6IRseSjyvKd1hFXD+MSFr/wzXSj9Gjb/Ms+/Fg8qZJGrv1rr4QjIlKSj9Sb6X++b7cBCyIw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50875444-2038-4ef5-e225-08d59db18f36 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:08.9725 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0806 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gustavo A. R. Silva" [ Upstream commit e4823fbd229bfbba368b40cdadb8f4eeb20604cc ] Add suffix ULL to constant 80000 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 used in a context that expects an expression of type u64. The current cast to u64 effectively applies to the whole expression as an argument of type u64 to be passed to div64_u64, but it does not prevent it from being evaluated using 32-bit arithmetic instead of 64-bit arithmetic. Also, once the expression is properly evaluated using 64-bit arithmentic, there is no need for the parentheses and the external cast to u64. Addresses-Coverity-ID: 1357588 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_nv.c b/net/ipv4/tcp_nv.c index e45e2c41c7bd..37a3cb999859 100644 --- a/net/ipv4/tcp_nv.c +++ b/net/ipv4/tcp_nv.c @@ -338,7 +338,7 @@ static void tcpnv_acked(struct sock *sk, const struct a= ck_sample *sample) */ cwnd_by_slope =3D (u32) div64_u64(((u64)ca->nv_rtt_max_rate) * ca->nv_min_rtt, - (u64)(80000 * tp->mss_cache)); + 80000ULL * tp->mss_cache); max_win =3D cwnd_by_slope + nv_pad; =20 /* If cwnd > max_win, decrease cwnd --=20 2.15.1