Skip to contentSkip to conversation

xfrm: remove redundant replay_esn check

PATCH In review Ulrich Weber 3 participants 3 messages Nov 8, 2012 – Nov 9, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: remove redundant replay_esn check

x->replay_esn is already checked in if clause,
so remove check and ident properly

---
 net/xfrm/xfrm_replay.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
net/xfrm/xfrm_replay.c +6 -7
index 3efb07d..765f6fe 100644
@@ -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;
 
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw
Quoted 9 lines · David Miller

From: Ulrich Weber <[email protected]>
Date: Thu, 8 Nov 2012 11:15:44 +0100

Quoted 4 lines

x->replay_esn is already checked in if clause,
so remove check and ident properly

Steffen, I assume you'll pick this one up.

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

Thanks!