Skip to content

Commit fa69325

Browse files
liu-song-6Alexei Starovoitov
authored andcommitted
bpf: Initialize used but uninit variable in propagate_liveness()
With input changed == NULL, a local variable is used for "changed". Initialize tmp properly, so that it can be used in the following: *changed |= err > 0; Otherwise, UBSAN will complain: UBSAN: invalid-load in kernel/bpf/verifier.c:18924:4 load of value <some random value> is not a valid value for type '_Bool' Fixes: dfb2d4c ("bpf: set 'changed' status if propagate_liveness() did any updates") Signed-off-by: Song Liu <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 50034d9 commit fa69325

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/bpf/verifier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18900,7 +18900,7 @@ static int propagate_liveness(struct bpf_verifier_env *env,
1890018900
struct bpf_reg_state *state_reg, *parent_reg;
1890118901
struct bpf_func_state *state, *parent;
1890218902
int i, frame, err = 0;
18903-
bool tmp;
18903+
bool tmp = false;
1890418904

1890518905
changed = changed ?: &tmp;
1890618906
if (vparent->curframe != vstate->curframe) {

0 commit comments

Comments
 (0)