netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request (net-next): ipsec-next 2018-12-20
@ 2018-12-20  8:20 Steffen Klassert
  2018-12-20  8:20 ` [PATCH 1/2] xfrm: policy: remove set but not used variable 'priority' Steffen Klassert
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steffen Klassert @ 2018-12-20  8:20 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

Two last patches for this release cycle:

1) Remove an unused variable in xfrm_policy_lookup_bytype().
   From YueHaibing.

2) Fix possible infinite loop in __xfrm6_tunnel_alloc_spi().
   Also from YueHaibing.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit 33f18c96afdf4da20014f834874e2820ee880cde:

  net: ethernet: don't set phylib state CHANGELINK in drivers (2018-12-18 22:07:20 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to fa89a4593b927b3f59c3b69379f31d3b22272e4e:

  xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi (2018-12-19 12:33:17 +0100)

----------------------------------------------------------------
YueHaibing (2):
      xfrm: policy: remove set but not used variable 'priority'
      xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi

 net/ipv6/xfrm6_tunnel.c | 3 +++
 net/xfrm/xfrm_policy.c  | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] xfrm: policy: remove set but not used variable 'priority'
  2018-12-20  8:20 pull request (net-next): ipsec-next 2018-12-20 Steffen Klassert
@ 2018-12-20  8:20 ` Steffen Klassert
  2018-12-20  8:20 ` [PATCH 2/2] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Steffen Klassert
  2018-12-20 16:22 ` pull request (net-next): ipsec-next 2018-12-20 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2018-12-20  8:20 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: YueHaibing <yuehaibing@huawei.com>

Fixes gcc '-Wunused-but-set-variable' warning:

net/xfrm/xfrm_policy.c: In function 'xfrm_policy_lookup_bytype':
net/xfrm/xfrm_policy.c:2079:6: warning:
 variable 'priority' set but not used [-Wunused-but-set-variable]

It not used since commit 6be3b0db6db8 ("xfrm: policy: add inexact policy
search tree infrastructure")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_policy.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index be04091eb7db..537b7eec623c 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2076,7 +2076,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 	struct xfrm_policy *pol, *ret;
 	struct hlist_head *chain;
 	unsigned int sequence;
-	u32 priority;
 	int err;
 
 	daddr = xfrm_flowi_daddr(fl, family);
@@ -2091,7 +2090,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 		chain = policy_hash_direct(net, daddr, saddr, family, dir);
 	} while (read_seqcount_retry(&xfrm_policy_hash_generation, sequence));
 
-	priority = ~0U;
 	ret = NULL;
 	hlist_for_each_entry_rcu(pol, chain, bydst) {
 		err = xfrm_policy_match(pol, fl, type, family, dir, if_id);
@@ -2104,7 +2102,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 			}
 		} else {
 			ret = pol;
-			priority = ret->priority;
 			break;
 		}
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi
  2018-12-20  8:20 pull request (net-next): ipsec-next 2018-12-20 Steffen Klassert
  2018-12-20  8:20 ` [PATCH 1/2] xfrm: policy: remove set but not used variable 'priority' Steffen Klassert
@ 2018-12-20  8:20 ` Steffen Klassert
  2018-12-20 16:22 ` pull request (net-next): ipsec-next 2018-12-20 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2018-12-20  8:20 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: YueHaibing <yuehaibing@huawei.com>

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>
---
 net/ipv6/xfrm6_tunnel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 4a46df8441c9..f5b4febeaa25 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: pull request (net-next): ipsec-next 2018-12-20
  2018-12-20  8:20 pull request (net-next): ipsec-next 2018-12-20 Steffen Klassert
  2018-12-20  8:20 ` [PATCH 1/2] xfrm: policy: remove set but not used variable 'priority' Steffen Klassert
  2018-12-20  8:20 ` [PATCH 2/2] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Steffen Klassert
@ 2018-12-20 16:22 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-12-20 16:22 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 20 Dec 2018 09:20:47 +0100

> Two last patches for this release cycle:
> 
> 1) Remove an unused variable in xfrm_policy_lookup_bytype().
>    From YueHaibing.
> 
> 2) Fix possible infinite loop in __xfrm6_tunnel_alloc_spi().
>    Also from YueHaibing.
> 
> Please pull or let me know if there are problems.

Pulled, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-20 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20  8:20 pull request (net-next): ipsec-next 2018-12-20 Steffen Klassert
2018-12-20  8:20 ` [PATCH 1/2] xfrm: policy: remove set but not used variable 'priority' Steffen Klassert
2018-12-20  8:20 ` [PATCH 2/2] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Steffen Klassert
2018-12-20 16:22 ` pull request (net-next): ipsec-next 2018-12-20 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).