From cb77e39b04904c8e8ae34d5bd6dd99c852018d52 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 5 Oct 2011 15:42:17 -0700 Subject: [PATCH] ofproto-dpif: Make compose_mirror_dsts() harder to screw up. I came close to add a "continue;" inside the main "while" loop in compose_mirror_dsts(), which would have turned it into an infinite loop. This commit changes it to a "for" loop that is harder to screw up. --- ofproto/ofproto-dpif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 8565a8d8..400b3532 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4650,7 +4650,7 @@ compose_mirror_dsts(struct action_xlate_ctx *ctx, } flow_vid = vlan_tci_to_vid(ctx->flow.vlan_tci); - while (mirrors) { + for (; mirrors; mirrors &= mirrors - 1) { struct ofmirror *m = ofproto->mirrors[mirror_mask_ffs(mirrors) - 1]; if (vlan_is_mirrored(m, vlan)) { struct dst dst; @@ -4685,7 +4685,6 @@ compose_mirror_dsts(struct action_xlate_ctx *ctx, } } } - mirrors &= mirrors - 1; } } -- 2.30.2