]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tcp_nv: fix potential integer overflow in tcpnv_acked
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 31 Jan 2018 04:21:48 +0000 (22:21 -0600)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 17:44:25 +0000 (13:44 -0400)
commit8033c183bf0d20aed15ee46d2ecd61d7131c1702
treeb1c06ac69cf447d725f9c7fd580dc4d70f08a867
parent9a0e1295e014a5eebfb35112ccb13806ac0b15c6
tcp_nv: fix potential integer overflow in tcpnv_acked

BugLink: http://bugs.launchpad.net/bugs/1774063
[ 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 <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/ipv4/tcp_nv.c