Thread (5 messages) 5 messages, 2 authors, 2021-10-10
STALE1700d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH bpf-next 2/2] bpf, mips: Modify check condition about tail call count

From: Tiezhu Yang <yangtiezhu@loongson.cn>
Date: 2021-10-09 10:58:20
Also in: bpf, linux-mips, lkml
Subsystem: bpf jit for mips (32-bit and 64-bit), bpf [general] (safe dynamic programs and tools), mips, the rest · Maintainers: Johan Almbladh, Paul Burton, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, Thomas Bogendoerfer, Linus Torvalds

In emit_tail_call() of bpf_jit_comp32.c, "blez t2" (t2 <= 0) is not
consistent with the comment "t2 < 0", modify the check condition to
keep consistency.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/net/bpf_jit_comp32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/net/bpf_jit_comp32.c b/arch/mips/net/bpf_jit_comp32.c
index 9d7041a..b887c01 100644
--- a/arch/mips/net/bpf_jit_comp32.c
+++ b/arch/mips/net/bpf_jit_comp32.c
@@ -1312,12 +1312,12 @@ static int emit_tail_call(struct jit_context *ctx)
 	emit(ctx, sltu, t1, ind, t1);            /* t1 = ind < t1            */
 	emit(ctx, beqz, t1, get_offset(ctx, 1)); /* PC += off(1) if t1 == 0  */
 						 /* (next insn delay slot)   */
-	/* if (TCC-- <= 0) goto out */
+	/* if (--TCC < 0) goto out */
 	emit(ctx, lw, t2, ctx->stack_size, MIPS_R_SP);  /* t2 = *(SP + size) */
 	emit_load_delay(ctx);                     /* Load delay slot         */
-	emit(ctx, blez, t2, get_offset(ctx, 1));  /* PC += off(1) if t2 < 0  */
 	emit(ctx, addiu, t2, t2, -1);             /* t2-- (delay slot)       */
 	emit(ctx, sw, t2, ctx->stack_size, MIPS_R_SP);  /* *(SP + size) = t2 */
+	emit(ctx, bltz, t2, get_offset(ctx, 1));  /* PC += off(1) if t2 < 0  */
 
 	/* prog = ary->ptrs[ind] */
 	off = offsetof(struct bpf_array, ptrs);
-- 
2.1.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help