Received: by 10.223.176.5 with SMTP id f5csp211805wra; Thu, 1 Feb 2018 18:45:38 -0800 (PST) X-Google-Smtp-Source: AH8x227n9Ouq6vfebmkIY2UV5Faem4m5nuQLh+S+r8xP7JIuGz3GK7frlcoTt97ulusqfX1sesGQ X-Received: by 10.99.122.82 with SMTP id j18mr29938306pgn.250.1517539538327; Thu, 01 Feb 2018 18:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517539538; cv=none; d=google.com; s=arc-20160816; b=gCXmrZa6nXI3ORP+ET2QUaVWGch8NwHlHxlRUuoIi+OVd7YQhVaL7N2Nst120SoXW3 hcu1TpamwCJxwfqQPIWv+u1mz5FVFl/6wmrT6TijEGhP6DHlYoj5+GpoE/OaH/Q0QlCc 4AxC7ptqjJzYOSYf5GIuKlCBY2ZWCt7I5Q23xWElObV1AMWsDddoUMSZCkcxSp3yhIhK 0rvn9ap3l85XrP4PAzBcj15U5LWkaKnhA8uinxRX6ws1koWZpD2MI7K4+KprjNEizV6t T8lOJO3qS2JzzfIJo/rCNVC23HQFqXEm1NSa97i2fEwF1U88rmlloikRtdbxMg8yvInj VgcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :user-agent:in-reply-to:references:subject:cc:to:from:message-id :date:arc-authentication-results; bh=UJLyNl3oSjbQsLrTkxeiBb9w/klkiPlu+wimgCs5d2k=; b=eFlKAS/h50rIIrdKJWkFg9nN70jOlli1No2/UYgq1vMXJ+MYJ0vrmO6ZP8m7UoJ0yu j2Tyam36yz+erDnJ/lG/z8tmsAUUCIzff67Ojlysr1/lgM5xlZ/PIFLY/gv7ddSsMZQd F+2HbHg6Z3psILJk3FgybLmtMx9ZtDpg7xyP4TPQOItPtJ2cuJRce8zF/Q3sxwapxtOf c8IcBy0S7s+mjNxUDINd24qu+ex3LUNdmhekwbBwsferQJF3GNNN+qWct5IjZoWDmGTj zeULBgFpq9/vwIRUadxqnWSUGWwJe10RppaLArv9zwaxMinqr9kEyKShWxTt82U6DvM2 TfVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 g59-v6si874384plb.469.2018.02.01.18.45.23; Thu, 01 Feb 2018 18:45:38 -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; 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 S1755232AbeBBCeE (ORCPT + 99 others); Thu, 1 Feb 2018 21:34:04 -0500 Received: from gateway33.websitewelcome.com ([192.185.145.216]:48721 "EHLO gateway33.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754125AbeBBCd4 (ORCPT ); Thu, 1 Feb 2018 21:33:56 -0500 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway33.websitewelcome.com (Postfix) with ESMTP id E36DF915326 for ; Thu, 1 Feb 2018 20:33:55 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id hRApeYcKRODN4hRApeTffl; Thu, 01 Feb 2018 20:33:55 -0600 Received: from gator4166.hostgator.com ([108.167.133.22]:50091) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ehRAn-000vkd-LE; Thu, 01 Feb 2018 20:33:53 -0600 Received: from 189.152.201.65 ([189.152.201.65]) by gator4166.hostgator.com (Horde Framework) with HTTPS; Thu, 01 Feb 2018 20:33:52 -0600 Date: Thu, 01 Feb 2018 20:33:52 -0600 Message-ID: <20180201203352.Horde.xv5XUdiSqNDHlFujzwjX6S0@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: David Laight Cc: Alan Cox , "Gustavo A. R. Silva" , "Wong Hoi Sing, Edison" , "Hung Hing Lun, Mike" , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit References: <20180201002407.GA1608@embeddedgus> <20180201003236.06143fd0@alans-desktop> <20180131190749.Horde.bsc7GhewsZwdnkmDtMlSwWO@gator4166.hostgator.com> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline 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: 108.167.133.22 X-Source-L: Yes X-Exim-ID: 1ehRAn-000vkd-LE X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:50091 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 11 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 Hi David, Quoting David Laight : >> > The question you need to ask is 'can it overflow 32bit maths', otherwise >> > you are potentially making the system do extra work for no reason. >> > >> >> Yeah, I get your point and it seems that in this particular case there >> is no risk of a 32bit overflow, but in general and IMHO as the code >> evolves, the use of incorrect arithmetic may have security >> implications in the future, so I advocate for code correctness in this >> case. > > Even if the variable are 64bit you still need to worry (maybe less) > about arithmetic overflow. > The only real way to avoid overflow is to understand the domain > of the values being used. > Yep, that's correct. Thanks for the feedback. -- Gustavo