xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi
authorYueHaibing <yuehaibing@huawei.com>
Wed, 19 Dec 2018 06:45:09 +0000 (14:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 09:09:00 +0000 (10:09 +0100)
commit13174e174f2d649c38fa50be31ae8ae9a82d805e
treeb96c1cbd9eda5ddc15e15861cd9c80a1612e9669
parent4a653aac3ed8ef630eb17d0d7f732538c3e7271e
xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi

[ Upstream commit fa89a4593b927b3f59c3b69379f31d3b22272e4e ]

gcc warn this:

net/ipv6/xfrm6_tunnel.c:143 __xfrm6_tunnel_alloc_spi() warn:
 always true condition '(spi <= 4294967295) => (0-u32max <= u32max)'

'spi' is u32, which always not greater than XFRM6_TUNNEL_SPI_MAX
because of wrap around. So the second forloop will never reach.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/xfrm6_tunnel.c