Re: [PATCH/RFC bpf-next 02/16] bpf: refactor propagate_live implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/03/2019 18:26, Jann Horn wrote:
On Tue, Mar 26, 2019 at 7:07 PM Jiong Wang <jiong.wang@xxxxxxxxxxxxx> wrote:
Some code inside current implementation of "propagate_liveness" is a little
bit verbose.

This patch refactor them so the code looks more simple and more clear.

The redundant usage of "vparent->frame[vstate->curframe]" is removed as we
are here. It is safe to do this because "state_equal" has guaranteed that
vstate->curframe must be equal with vparent->curframe.
[...]
@@ -6050,6 +6050,22 @@ static bool states_equal(struct bpf_verifier_env *env,
         return true;
  }

+static int propagate_liveness_reg(struct bpf_verifier_env *env,
+                                 struct bpf_reg_state *reg,
+                                 struct bpf_reg_state *parent_reg, u8 flag)
This function takes four arguments...

[...]
@@ -6071,16 +6088,13 @@ static int propagate_liveness(struct bpf_verifier_env *env,
[...]
+               err = propagate_liveness_reg(env, &regs[i], &parent_regs[i]);
.. but both here...

[...]
@@ -6089,11 +6103,13 @@ static int propagate_liveness(struct bpf_verifier_env *env,
[...]
+                       err = propagate_liveness_reg(env, reg, parent_reg);
... and here you only pass in three arguments? Does this compile?

Yes, it compiles. It is fixed in patch 03/16...

I was doing some simplification on 03/16, then found it's better
to be put into 02/16, and forget to update the function prototype there,

apology for this.

Regards,
Jiong




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux