Patchwork xfrm: remove redundant replay_esn check

login
register
mail settings
Submitter Ulrich Weber
Date Nov. 8, 2012, 10:15 a.m.
Message ID <20121108101544.GA30309@uweber-WS>
Download mbox | patch
Permalink /patch/197821/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Ulrich Weber - Nov. 8, 2012, 10:15 a.m.
x->replay_esn is already checked in if clause,
so remove check and ident properly

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
---
 net/xfrm/xfrm_replay.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
David Miller - Nov. 9, 2012, 3 a.m.
From: Ulrich Weber <ulrich.weber@sophos.com>
Date: Thu, 8 Nov 2012 11:15:44 +0100

> x->replay_esn is already checked in if clause,
> so remove check and ident properly
> 
> Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>

Steffen, I assume you'll pick this one up.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steffen Klassert - Nov. 9, 2012, 7:59 a.m.
On Thu, Nov 08, 2012 at 10:00:20PM -0500, David Miller wrote:
> From: Ulrich Weber <ulrich.weber@sophos.com>
> Date: Thu, 8 Nov 2012 11:15:44 +0100
> 
> > x->replay_esn is already checked in if clause,
> > so remove check and ident properly
> > 
> > Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
> 
> Steffen, I assume you'll pick this one up.

Yes, it was already in my queue. Now applied to ipsec-next.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 3efb07d..765f6fe 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -521,13 +521,12 @@  int xfrm_init_replay(struct xfrm_state *x)
 		    replay_esn->bmp_len * sizeof(__u32) * 8)
 			return -EINVAL;
 
-	if ((x->props.flags & XFRM_STATE_ESN) && replay_esn->replay_window == 0)
-		return -EINVAL;
-
-	if ((x->props.flags & XFRM_STATE_ESN) && x->replay_esn)
-		x->repl = &xfrm_replay_esn;
-	else
-		x->repl = &xfrm_replay_bmp;
+		if (x->props.flags & XFRM_STATE_ESN) {
+			if (replay_esn->replay_window == 0)
+				return -EINVAL;
+			x->repl = &xfrm_replay_esn;
+		} else
+			x->repl = &xfrm_replay_bmp;
 	} else
 		x->repl = &xfrm_replay_legacy;