Thread (3 messages) 3 messages, 3 authors, 2021-12-23

Re: [PATCH] bpf: clean up unnecessary conditional judgments

From: Alexei Starovoitov <hidden>
Date: 2021-12-23 04:43:35

On Wed, Dec 22, 2021 at 5:10 AM Jackie Liu [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Jackie Liu <redacted>

s32 is always true regardless of the values of its operands. let's
cleanup.

Fixes: e572ff80f05c ("bpf: Make 32->64 bounds propagation slightly more robust")
Reported-by: k2ci <redacted>
Signed-off-by: Jackie Liu <redacted>
---
 kernel/bpf/verifier.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index b532f1058d35..43812ee58304 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1366,11 +1366,6 @@ static void __reg_bound_offset(struct bpf_reg_state *reg)
        reg->var_off = tnum_or(tnum_clear_subreg(var64_off), var32_off);
 }

-static bool __reg32_bound_s64(s32 a)
-{
-       return a >= 0 && a <= S32_MAX;
-}
-
The code is the best documentation.
Here it clearly describes the intent.
Please ignore compiler warnings.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help