bpf: refactor propagate_liveness to eliminate duplicated for loop
authorJiong Wang <jiong.wang@netronome.com>
Fri, 12 Apr 2019 21:59:34 +0000 (22:59 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 13 Apr 2019 00:06:33 +0000 (17:06 -0700)
Propagation for register and stack slot are finished in separate for loop,
while they are perfect to be put into a single loop.

This could also let them share some common variables in later patches.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index 15ab6fa817ce495a261303171da839bfa2da31b4..da285df492fda1995865726af9e970bf4b626edb 100644 (file)
@@ -6254,10 +6254,8 @@ static int propagate_liveness(struct bpf_verifier_env *env,
                                        return err;
                        }
                }
-       }
 
-       /* ... and stack slots */
-       for (frame = 0; frame <= vstate->curframe; frame++) {
+               /* Propagate stack slots. */
                state = vstate->frame[frame];
                parent = vparent->frame[frame];
                for (i = 0; i < state->allocated_stack / BPF_REG_SIZE &&