From nobody Thu Feb 12 12:34:56 2026 Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 71C2A16D4EF; Wed, 12 Jun 2024 08:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182742; cv=none; b=NbY8TYvPDAZx6Prt3Wg/A8UiilcZUEQqCJbx+O5NOuDwxXR4DkWavIeSS3bbTqN1skxhA4hXsTS5AfLwu7YSpoW65MC/nauPkqTYhE8CeAbxbw/CXyZ/BYP+L3Xz62zgyMyusy8N2KhboxzoEnn6Bpcv3ZEMcg+8BAKCBFWepJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182742; c=relaxed/simple; bh=IPCWgpd6c1bFEoB2WSV9QRjQj7pwRw3QVv26rxSLklw=; h=From:To:Cc:Subject:Date:Message-Id; b=l+yp1dRdTYARkoG/NkN0SDMxkn2UuxOKAsrAXgzEbatk4s/eY4CYqPMOJVcNTP1d9sDmlAwTOG/fSOO3Qlr/WCRv3knwUTH69M5T8LCp0S50M9IeeRUcmf1Qjt4OxUk82SEEcou5ieLPq7BOG0O0fgJCGp157Vkn3Rg+NxGxAQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 6C0126022F9AD; Wed, 12 Jun 2024 16:58:36 +0800 (CST) X-MD-Sfrom: kunyu@nfschina.com X-MD-SrcIP: 219.141.250.2 From: kunyu To: davem@davemloft.net, dsahern@kernel.org, udknight@gmail.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, kunyu Subject: [PATCH] x86: net: bpf_jit_comp32: Remove unused 'cnt' variables from most functions Date: Wed, 12 Jun 2024 16:58:23 +0800 Message-Id: <20240612085823.28133-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In these functions, the 'cnt' variable is not used or does not require value checking, so these 'cnt' variables can be removed. Signed-off-by: kunyu --- arch/x86/net/bpf_jit_comp32.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c index de0f9e5f9f73..30f9b8a3faed 100644 --- a/arch/x86/net/bpf_jit_comp32.c +++ b/arch/x86/net/bpf_jit_comp32.c @@ -207,7 +207,6 @@ static inline void emit_ia32_mov_i(const u8 dst, const = u32 val, bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; =20 if (dstk) { if (val =3D=3D 0) { @@ -235,7 +234,6 @@ static inline void emit_ia32_mov_r(const u8 dst, const = u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 sreg =3D sstk ? IA32_EAX : src; =20 if (sstk) @@ -286,7 +284,6 @@ static inline void emit_ia32_mul_r(const u8 dst, const = u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 sreg =3D sstk ? IA32_ECX : src; =20 if (sstk) @@ -319,7 +316,6 @@ static inline void emit_ia32_to_le_r64(const u8 dst[], = s32 val, const struct bpf_prog_aux *aux) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -367,7 +363,6 @@ static inline void emit_ia32_to_be_r64(const u8 dst[], = s32 val, const struct bpf_prog_aux *aux) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -436,7 +431,6 @@ static inline void emit_ia32_div_mod_r(const u8 op, con= st u8 dst, const u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; =20 if (sstk) /* mov ecx,dword ptr [ebp+off] */ @@ -483,7 +477,6 @@ static inline void emit_ia32_shift_r(const u8 op, const= u8 dst, const u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg =3D dstk ? IA32_EAX : dst; u8 b2; =20 @@ -525,7 +518,6 @@ static inline void emit_ia32_alu_r(const bool is64, con= st bool hi, const u8 op, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 sreg =3D sstk ? IA32_EAX : src; u8 dreg =3D dstk ? IA32_EDX : dst; =20 @@ -599,7 +591,6 @@ static inline void emit_ia32_alu_i(const bool is64, con= st bool hi, const u8 op, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg =3D dstk ? IA32_EAX : dst; u8 sreg =3D IA32_EDX; =20 @@ -698,7 +689,6 @@ static inline void emit_ia32_alu_i64(const bool is64, c= onst u8 op, static inline void emit_ia32_neg64(const u8 dst[], bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -732,7 +722,6 @@ static inline void emit_ia32_lsh_r64(const u8 dst[], co= nst u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -785,7 +774,6 @@ static inline void emit_ia32_arsh_r64(const u8 dst[], c= onst u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -838,7 +826,6 @@ static inline void emit_ia32_rsh_r64(const u8 dst[], co= nst u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -891,7 +878,6 @@ static inline void emit_ia32_lsh_i64(const u8 dst[], co= nst u32 val, bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -939,7 +925,6 @@ static inline void emit_ia32_rsh_i64(const u8 dst[], co= nst u32 val, bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -988,7 +973,6 @@ static inline void emit_ia32_arsh_i64(const u8 dst[], c= onst u32 val, bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u8 dreg_lo =3D dstk ? IA32_EAX : dst_lo; u8 dreg_hi =3D dstk ? IA32_EDX : dst_hi; =20 @@ -1036,7 +1020,6 @@ static inline void emit_ia32_mul_r64(const u8 dst[], = const u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; =20 if (dstk) /* mov eax,dword ptr [ebp+off] */ @@ -1113,7 +1096,6 @@ static inline void emit_ia32_mul_i64(const u8 dst[], = const u32 val, bool dstk, u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; u32 hi; =20 hi =3D val & (1<<31) ? (u32)~0 : 0; @@ -1200,7 +1182,6 @@ struct jit_context { static void emit_prologue(u8 **pprog, u32 stack_depth) { u8 *prog =3D *pprog; - int cnt =3D 0; const u8 *r1 =3D bpf2ia32[BPF_REG_1]; const u8 fplo =3D bpf2ia32[BPF_REG_FP][0]; const u8 fphi =3D bpf2ia32[BPF_REG_FP][1]; @@ -1237,7 +1218,6 @@ static void emit_prologue(u8 **pprog, u32 stack_depth) EMIT3(0x89, add_2reg(0x40, IA32_EBP, IA32_EBX), STACK_VAR(tcc[0])); EMIT3(0x89, add_2reg(0x40, IA32_EBP, IA32_EBX), STACK_VAR(tcc[1])); =20 - BUILD_BUG_ON(cnt !=3D PROLOGUE_SIZE); *pprog =3D prog; } =20 @@ -1246,7 +1226,6 @@ static void emit_epilogue(u8 **pprog, u32 stack_depth) { u8 *prog =3D *pprog; const u8 *r0 =3D bpf2ia32[BPF_REG_0]; - int cnt =3D 0; =20 /* mov eax,dword ptr [ebp+off]*/ EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EAX), STACK_VAR(r0[0])); @@ -1391,7 +1370,6 @@ static void emit_bpf_tail_call(u8 **pprog, u8 *ip) static inline void emit_push_r64(const u8 src[], u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; =20 /* mov ecx,dword ptr [ebp+off] */ EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_ECX), STACK_VAR(src_hi)); @@ -1409,7 +1387,6 @@ static inline void emit_push_r64(const u8 src[], u8 *= *pprog) static void emit_push_r32(const u8 src[], u8 **pprog) { u8 *prog =3D *pprog; - int cnt =3D 0; =20 /* mov ecx,dword ptr [ebp+off] */ EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_ECX), STACK_VAR(src_lo)); @@ -1570,7 +1547,7 @@ static int emit_kfunc_call(const struct bpf_prog *bpf= _prog, u8 *end_addr, const struct bpf_insn *insn, u8 **pprog) { const u8 arg_regs[] =3D { IA32_EAX, IA32_EDX, IA32_ECX }; - int i, cnt =3D 0, first_stack_regno, last_stack_regno; + int i, first_stack_regno, last_stack_regno; int free_arg_regs =3D ARRAY_SIZE(arg_regs); const struct btf_func_model *fm; int bytes_in_stack =3D 0; @@ -1663,7 +1640,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *add= rs, u8 *image, int insn_cnt =3D bpf_prog->len; bool seen_exit =3D false; u8 temp[BPF_MAX_INSN_SIZE + BPF_INSN_SAFETY]; - int i, cnt =3D 0; + int i; int proglen =3D 0; u8 *prog =3D temp; =20 --=20 2.18.2