Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp313110lqp; Wed, 12 Jun 2024 02:19:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqJyreGgST2Kd24Qr60FlWM1WYke/OJodA0zyhQRWmXx9qgALaLDWDGhptq8ly8IstXNrT3zBtb2fRvrW/CWtC9k/v9QishA/OOlfeQA== X-Google-Smtp-Source: AGHT+IGkCQa6i/B6Ljq65SDPwrROWLKel6HB6C2EOPanrb40iHUn9MTywC/zCjOe3WYSDotXDtfJ X-Received: by 2002:a05:6358:418e:b0:19f:54a7:4f0b with SMTP id e5c5f4694b2df-19f69d553c2mr165283755d.19.1718183995897; Wed, 12 Jun 2024 02:19:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718183995; cv=pass; d=google.com; s=arc-20160816; b=Wd9xLywOSdUAANq8KpJ2z+qVwXNroQvWExTfr96xR/aSiNtvdUecnz+ilNWtfD7gkk 28cmev2AZN1lEhioa20O0lxZ0WG2HFtPol3rMdn1NSRS2oeFraihz7Z6JVBf2YJyOztO HAjLpDIXu2qkZvCa3fFM4i63I238e893pcUi3zNwGs4QcMZVXsOogMJXKXF/bUNxSeLK hD5QUQzKiYPxQpF3SvGe12uq/wsTwfhhniFF13a2TTTC5mm0jnWwdFnuRUcbskWePca0 GMmNmqzrW9tTPYcjXUfeWBS2C13V8O2UvjSpwB178JJGdvx6I4RtaJ7huh6RcGr/nNs8 NMZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=NWqCI7Cxr3QYLJnLTbgdLo1Wynbb8+je9xAEayRPhX0=; fh=Qfz8iqixfIMUC5GoOCfmHOrRLnMhCbTAcnOZUSKUCsQ=; b=F0akrGl76oHYc1CcoF055MeXKGQcSQ1avAQk0UdyBS4eAWn1I2znBQGgaHpHghU/2Z vsMHtKt0xA+9dx143hnUfIYgmhAqyLiu9ZjAhr0qRQrcOY47yKTjEsv+rN44wvOX1Zyd CAy/IOTwN+qDMa/3NDSveeDPzeuRV0Bylg29Pm/3z4Lo04Kk3tbISUFZHJvbsqJ/4As0 j/U6zkZOiMGJy/B0vrgN71WgvNEvDLNyz/9kl6kDsdQDp6MUxu3QREpRj3eh1p3G7dVX KyUQmoZi93BVaZRCbKgQgonG0f87vTRt5eyzFuEJwEP5VtTKj0iR0J2M+YnW7ep+OJpv qNXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-211226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211226-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2a27b5f6si7392452a12.793.2024.06.12.02.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:19:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-211226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211226-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7188EB27E60 for ; Wed, 12 Jun 2024 08:59:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1322516D9C2; Wed, 12 Jun 2024 08:59:03 +0000 (UTC) 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: 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 = *pprog; - int cnt = 0; if (dstk) { if (val == 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 = *pprog; - int cnt = 0; u8 sreg = sstk ? IA32_EAX : src; 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 = *pprog; - int cnt = 0; u8 sreg = sstk ? IA32_ECX : src; 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 = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -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 = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -436,7 +431,6 @@ static inline void emit_ia32_div_mod_r(const u8 op, const u8 dst, const u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; 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 = *pprog; - int cnt = 0; u8 dreg = dstk ? IA32_EAX : dst; u8 b2; @@ -525,7 +518,6 @@ static inline void emit_ia32_alu_r(const bool is64, const bool hi, const u8 op, bool sstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 sreg = sstk ? IA32_EAX : src; u8 dreg = dstk ? IA32_EDX : dst; @@ -599,7 +591,6 @@ static inline void emit_ia32_alu_i(const bool is64, const bool hi, const u8 op, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg = dstk ? IA32_EAX : dst; u8 sreg = IA32_EDX; @@ -698,7 +689,6 @@ static inline void emit_ia32_alu_i64(const bool is64, const u8 op, static inline void emit_ia32_neg64(const u8 dst[], bool dstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -732,7 +722,6 @@ static inline void emit_ia32_lsh_r64(const u8 dst[], const u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -785,7 +774,6 @@ static inline void emit_ia32_arsh_r64(const u8 dst[], const u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -838,7 +826,6 @@ static inline void emit_ia32_rsh_r64(const u8 dst[], const u8 src[], bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -891,7 +878,6 @@ static inline void emit_ia32_lsh_i64(const u8 dst[], const u32 val, bool dstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -939,7 +925,6 @@ static inline void emit_ia32_rsh_i64(const u8 dst[], const u32 val, bool dstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -988,7 +973,6 @@ static inline void emit_ia32_arsh_i64(const u8 dst[], const u32 val, bool dstk, u8 **pprog) { u8 *prog = *pprog; - int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; @@ -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 = *pprog; - int cnt = 0; 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 = *pprog; - int cnt = 0; u32 hi; hi = val & (1<<31) ? (u32)~0 : 0; @@ -1200,7 +1182,6 @@ struct jit_context { static void emit_prologue(u8 **pprog, u32 stack_depth) { u8 *prog = *pprog; - int cnt = 0; const u8 *r1 = bpf2ia32[BPF_REG_1]; const u8 fplo = bpf2ia32[BPF_REG_FP][0]; const u8 fphi = 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])); - BUILD_BUG_ON(cnt != PROLOGUE_SIZE); *pprog = prog; } @@ -1246,7 +1226,6 @@ static void emit_epilogue(u8 **pprog, u32 stack_depth) { u8 *prog = *pprog; const u8 *r0 = bpf2ia32[BPF_REG_0]; - int cnt = 0; /* 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 = *pprog; - int cnt = 0; /* 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 = *pprog; - int cnt = 0; /* 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[] = { IA32_EAX, IA32_EDX, IA32_ECX }; - int i, cnt = 0, first_stack_regno, last_stack_regno; + int i, first_stack_regno, last_stack_regno; int free_arg_regs = ARRAY_SIZE(arg_regs); const struct btf_func_model *fm; int bytes_in_stack = 0; @@ -1663,7 +1640,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, int insn_cnt = bpf_prog->len; bool seen_exit = false; u8 temp[BPF_MAX_INSN_SIZE + BPF_INSN_SAFETY]; - int i, cnt = 0; + int i; int proglen = 0; u8 *prog = temp; -- 2.18.2