From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH] tcp_nv: fix potential integer overflow in tcpnv_acked Date: Wed, 31 Jan 2018 10:33:00 -0500 (EST) Message-ID: <20180131.103300.1736696032660575093.davem@davemloft.net> References: <20180131042147.GA13245@embeddedgus> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, garsilva@embeddedor.com To: gustavo@embeddedor.com Return-path: In-Reply-To: <20180131042147.GA13245@embeddedgus> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: "Gustavo A. R. Silva" Date: Tue, 30 Jan 2018 22:21:48 -0600 > 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 Applied.