mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi
[ Upstream commit fa89a4593b
]
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>
This commit is contained in:
parent
4470e51361
commit
a1708a81ba
1 changed files with 3 additions and 0 deletions
|
@ -144,6 +144,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
|
|||
index = __xfrm6_tunnel_spi_check(net, spi);
|
||||
if (index >= 0)
|
||||
goto alloc_spi;
|
||||
|
||||
if (spi == XFRM6_TUNNEL_SPI_MAX)
|
||||
break;
|
||||
}
|
||||
for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) {
|
||||
index = __xfrm6_tunnel_spi_check(net, spi);
|
||||
|
|
Loading…
Reference in a new issue