From patchwork Sat Jun 15 02:24:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Passos X-Patchwork-Id: 13699239 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail71.out.titan.email (mail71.out.titan.email [209.209.25.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C04F79F5 for ; Sat, 15 Jun 2024 07:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.209.25.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718435650; cv=none; b=ocJDBgRYZFY8feFRWtkoI5ZLS9raB+PJfln/vtxSAd9eeJqL8vq6yQgO6CXuqc/3AftlGIYA51rvsYQ24edrcwU8f4CW0Qpm51qr8Ja31CfWTzSthABUlkcLKQFmLlNBAKjMFWEvNbSM4yUhD9KOxOX3g0TF3uv9rdl2vIWeO3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718435650; c=relaxed/simple; bh=anPG9CE8wI7z2sJ/hcWhURkt8KwfaIY3f6wDeE81tyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PnVpHwyLjO8lvK7P6Jd4zaE4hCFs4bpivQPIpjeRnfPyXWGh5xUJLi9/cgKB24/NBnNSSKienE3TWY62+AdS1dRwzhaRJX9unL9ZSnYkzol8faimBkQIQQbvI4DXBK5M3I3uMDANcz7j5S102qrjsskmcQSiuIBMldOQ8WOShRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me; spf=fail smtp.mailfrom=rcpassos.me; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b=O0L5eScF; arc=none smtp.client-ip=209.209.25.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b="O0L5eScF" Received: from smtp-out.flockmail.com (localhost [127.0.0.1]) by smtp-out.flockmail.com (Postfix) with ESMTP id D59E6140134; Sat, 15 Jun 2024 02:28:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=BkI70YSVQkL9NnOSiJwJmMwNFfsQfSwBhRvdgZXcvwM=; c=relaxed/relaxed; d=rcpassos.me; h=from:references:mime-version:subject:to:in-reply-to:cc:date:message-id:from:to:cc:subject:date:message-id:in-reply-to:references:reply-to; q=dns/txt; s=titan1; t=1718418506; v=1; b=O0L5eScF9kjNsb+QD0Twa+4RYxZG4QkVVCCpZhdfWN9eo6gw7wILIygyp6oCfoRSgwBReNfj IjF97Ddbr9oeP6mPX4RHGj9ehn17PByRpxR4PKV2lIQVpZfBVq7Kd3zaKO3u4nxRkHtC70BCLTz 8aKpnA7EtskMPhKu2ybED/uk= Received: from darkforce.pihole.rcpassos.me (unknown [104.28.243.51]) by smtp-out.flockmail.com (Postfix) with ESMTPA id 82B79140051; Sat, 15 Jun 2024 02:28:24 +0000 (UTC) Feedback-ID: :rafael@rcpassos.me:rcpassos.me:flockmailId From: Rafael Passos To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, puranjay@kernel.org, will@kernel.org, xi.wang@gmail.com, bjorn@kernel.org, davem@davemloft.net, dsahern@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de Cc: Rafael Passos , bpf@vger.kernel.org Subject: [PATCH bpf-next V2 1/3] bpf: remove unused parameter in bpf_jit_binary_pack_finalize Date: Fri, 14 Jun 2024 23:24:08 -0300 Message-ID: <20240615022641.210320-2-rafael@rcpassos.me> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240615022641.210320-1-rafael@rcpassos.me> References: <20240615022641.210320-1-rafael@rcpassos.me> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-F-Verdict: SPFVALID X-Titan-Src-Out: 1718418506743325457.23820.1194268936732658971@prod-use1-smtp-out1003. X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=W6Y+VwWk c=1 sm=1 tr=0 ts=666cfc4a a=rO3HKV82O4ipXYUjDYeURw==:117 a=rO3HKV82O4ipXYUjDYeURw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=CEWIc4RMnpUA:10 a=IHYL5owqxkw3MIL43fUA:9 a=---8k2CCGq07aBBJLGWX:22 X-Virus-Scanned: ClamAV using ClamSMTP X-Patchwork-Delegate: bpf@iogearbox.net Fixes a compiler warning. the bpf_jit_binary_pack_finalize function was taking an extra bpf_prog parameter that went unused. This removves it and updates the callers accordingly. Signed-off-by: Rafael Passos --- arch/arm64/net/bpf_jit_comp.c | 3 +-- arch/powerpc/net/bpf_jit_comp.c | 4 ++-- arch/riscv/net/bpf_jit_core.c | 5 ++--- arch/x86/net/bpf_jit_comp.c | 4 ++-- include/linux/filter.h | 3 +-- kernel/bpf/core.c | 3 +-- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 720336d28856..6edaeafd1499 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1829,8 +1829,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = 0; goto out_free_hdr; } - if (WARN_ON(bpf_jit_binary_pack_finalize(prog, ro_header, - header))) { + if (WARN_ON(bpf_jit_binary_pack_finalize(ro_header, header))) { /* ro_header has been freed */ ro_header = NULL; prog = orig_prog; diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 984655419da5..2a36cc2e7e9e 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -225,7 +225,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) fp->jited_len = proglen + FUNCTION_DESCR_SIZE; if (!fp->is_func || extra_pass) { - if (bpf_jit_binary_pack_finalize(fp, fhdr, hdr)) { + if (bpf_jit_binary_pack_finalize(fhdr, hdr)) { fp = org_fp; goto out_addrs; } @@ -348,7 +348,7 @@ void bpf_jit_free(struct bpf_prog *fp) * before freeing it. */ if (jit_data) { - bpf_jit_binary_pack_finalize(fp, jit_data->fhdr, jit_data->hdr); + bpf_jit_binary_pack_finalize(jit_data->fhdr, jit_data->hdr); kvfree(jit_data->addrs); kfree(jit_data); } diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c index 0a96abdaca65..6de753c667f4 100644 --- a/arch/riscv/net/bpf_jit_core.c +++ b/arch/riscv/net/bpf_jit_core.c @@ -178,8 +178,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = prog_size - cfi_get_offset(); if (!prog->is_func || extra_pass) { - if (WARN_ON(bpf_jit_binary_pack_finalize(prog, jit_data->ro_header, - jit_data->header))) { + if (WARN_ON(bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header))) { /* ro_header has been freed */ jit_data->ro_header = NULL; prog = orig_prog; @@ -258,7 +257,7 @@ void bpf_jit_free(struct bpf_prog *prog) * before freeing it. */ if (jit_data) { - bpf_jit_binary_pack_finalize(prog, jit_data->ro_header, jit_data->header); + bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header); kfree(jit_data); } hdr = bpf_jit_binary_pack_hdr(prog); diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 5159c7a22922..bd7e13602bf6 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -3363,7 +3363,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) * * Both cases are serious bugs and justify WARN_ON. */ - if (WARN_ON(bpf_jit_binary_pack_finalize(prog, header, rw_header))) { + if (WARN_ON(bpf_jit_binary_pack_finalize(header, rw_header))) { /* header has been freed */ header = NULL; goto out_image; @@ -3442,7 +3442,7 @@ void bpf_jit_free(struct bpf_prog *prog) * before freeing it. */ if (jit_data) { - bpf_jit_binary_pack_finalize(prog, jit_data->header, + bpf_jit_binary_pack_finalize(jit_data->header, jit_data->rw_header); kvfree(jit_data->addrs); kfree(jit_data); diff --git a/include/linux/filter.h b/include/linux/filter.h index b02aea291b7e..dd41a93f06b2 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1129,8 +1129,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **ro_image, struct bpf_binary_header **rw_hdr, u8 **rw_image, bpf_jit_fill_hole_t bpf_fill_ill_insns); -int bpf_jit_binary_pack_finalize(struct bpf_prog *prog, - struct bpf_binary_header *ro_header, +int bpf_jit_binary_pack_finalize(struct bpf_binary_header *ro_header, struct bpf_binary_header *rw_header); void bpf_jit_binary_pack_free(struct bpf_binary_header *ro_header, struct bpf_binary_header *rw_header); diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 1a6c3faa6e4a..f6951c33790d 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1174,8 +1174,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **image_ptr, } /* Copy JITed text from rw_header to its final location, the ro_header. */ -int bpf_jit_binary_pack_finalize(struct bpf_prog *prog, - struct bpf_binary_header *ro_header, +int bpf_jit_binary_pack_finalize(struct bpf_binary_header *ro_header, struct bpf_binary_header *rw_header) { void *ptr; From patchwork Sat Jun 15 02:24:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Passos X-Patchwork-Id: 13699217 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail116.out.titan.email (mail116.out.titan.email [54.173.78.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1AAC3C17 for ; Sat, 15 Jun 2024 02:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.173.78.241 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718419756; cv=none; b=LgN9NtFzbu8q7DbDFZT2UasC6W+Nfrer6rip7/UhQx/9TYT5Ow6YCulhblTgrUMVH+iUOtaANTA/CX4Aizb0zWzkJDaCtivwV6NLnjStcalCKNukvTf5/8a8hZDUJO33OFzJACu99Y6Hl6wemWhptZh5vUl5eEXIVSCPMYLUanY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718419756; c=relaxed/simple; bh=07rFAS8WwGZWiaPyO800g9sGe85Ge0zho1a5Q+zggSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=trEvCSeCRfYTmf2AG8ZgtQh0FkKYbdcROtZVub9my3whnnYNM4B3jpVAUKhpfjMkQSOwzkBlzjGeN19l4uwW6/noRu0cCiZ1mX0XbwVNepskeUFqVDpLf50Y3aMEx9TMjkXngnWsAzijebW95DZ4559d5G6W8W99/upJi7jIelE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me; spf=fail smtp.mailfrom=rcpassos.me; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b=aU0w9KNP; arc=none smtp.client-ip=54.173.78.241 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b="aU0w9KNP" Received: from smtp-out.flockmail.com (localhost [127.0.0.1]) by smtp-out.flockmail.com (Postfix) with ESMTP id 07E7DE0004; Sat, 15 Jun 2024 02:30:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cGsEWPmFAOpeOF34QVN3RL42zid/Nqkv3FBPOLsZFr4=; c=relaxed/relaxed; d=rcpassos.me; h=in-reply-to:from:cc:subject:message-id:mime-version:to:date:references:from:to:cc:subject:date:message-id:in-reply-to:references:reply-to; q=dns/txt; s=titan1; t=1718418604; v=1; b=aU0w9KNPh/E7qbUm/8QafWcv/g3f+RR+aN/O72+V2DdVZagebvZED+ijh8Sj8YdHuWUOVy+l 3/lYgM13wa6/7H6VMcMrvZ9zYB2cb3HA+aYe+b7gh2vrAAyuLra3MtMISQt1a1xGY0cK2Lc33W+ 6vcS0cEqizbz0EOgmpNxzEzA= Received: from darkforce.pihole.rcpassos.me (unknown [104.28.243.51]) by smtp-out.flockmail.com (Postfix) with ESMTPA id 030A2E0081; Sat, 15 Jun 2024 02:30:03 +0000 (UTC) Feedback-ID: :rafael@rcpassos.me:rcpassos.me:flockmailId From: Rafael Passos To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org Cc: Rafael Passos , bpf@vger.kernel.org Subject: [PATCH bpf-next V2 2/3] bpf: remove unused parameter in __bpf_free_used_btfs Date: Fri, 14 Jun 2024 23:24:09 -0300 Message-ID: <20240615022641.210320-3-rafael@rcpassos.me> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240615022641.210320-1-rafael@rcpassos.me> References: <20240615022641.210320-1-rafael@rcpassos.me> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-F-Verdict: SPFVALID X-Titan-Src-Out: 1718418604915340736.31293.5894362100255476690@prod-use1-smtp-out1004. X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=W6Y+VwWk c=1 sm=1 tr=0 ts=666cfcac a=rO3HKV82O4ipXYUjDYeURw==:117 a=rO3HKV82O4ipXYUjDYeURw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=CEWIc4RMnpUA:10 a=c6FAzJyZY7ECWPs6LbIA:9 a=---8k2CCGq07aBBJLGWX:22 X-Virus-Scanned: ClamAV using ClamSMTP X-Patchwork-Delegate: bpf@iogearbox.net Fixes a compiler warning. The __bpf_free_used_btfs function was taking an extra unused struct bpf_prog_aux *aux param Signed-off-by: Rafael Passos --- include/linux/bpf.h | 3 +-- kernel/bpf/core.c | 5 ++--- kernel/bpf/verifier.c | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index f636b4998bf7..960780ef04e1 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -2933,8 +2933,7 @@ bpf_probe_read_kernel_common(void *dst, u32 size, const void *unsafe_ptr) return ret; } -void __bpf_free_used_btfs(struct bpf_prog_aux *aux, - struct btf_mod_pair *used_btfs, u32 len); +void __bpf_free_used_btfs(struct btf_mod_pair *used_btfs, u32 len); static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type) diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index f6951c33790d..ae2e1eeda0d4 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2742,8 +2742,7 @@ static void bpf_free_used_maps(struct bpf_prog_aux *aux) kfree(aux->used_maps); } -void __bpf_free_used_btfs(struct bpf_prog_aux *aux, - struct btf_mod_pair *used_btfs, u32 len) +void __bpf_free_used_btfs(struct btf_mod_pair *used_btfs, u32 len) { #ifdef CONFIG_BPF_SYSCALL struct btf_mod_pair *btf_mod; @@ -2760,7 +2759,7 @@ void __bpf_free_used_btfs(struct bpf_prog_aux *aux, static void bpf_free_used_btfs(struct bpf_prog_aux *aux) { - __bpf_free_used_btfs(aux, aux->used_btfs, aux->used_btf_cnt); + __bpf_free_used_btfs(aux->used_btfs, aux->used_btf_cnt); kfree(aux->used_btfs); } diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index acc9dd830807..c703612e04f7 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -18619,8 +18619,7 @@ static void release_maps(struct bpf_verifier_env *env) /* drop refcnt of maps used by the rejected program */ static void release_btfs(struct bpf_verifier_env *env) { - __bpf_free_used_btfs(env->prog->aux, env->used_btfs, - env->used_btf_cnt); + __bpf_free_used_btfs(env->used_btfs, env->used_btf_cnt); } /* convert pseudo BPF_LD_IMM64 into generic BPF_LD_IMM64 */ From patchwork Sat Jun 15 02:24:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Passos X-Patchwork-Id: 13699216 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail52.out.titan.email (mail52.out.titan.email [209.209.25.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B41592907 for ; Sat, 15 Jun 2024 02:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.209.25.115 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718419756; cv=none; b=DU5pM56vEm9f5ztnO/0+Y7cSX2i9p4TL6pJc1AO6JWUj941PQHE3JYWzfm9m5aBVhB+brBA5l12c1MnB7lCcAeLOgmoL+BGcSYcCPhDib3drsbc4Mh6dEszNvLoWPgu5Uu9chkgcIHFHCtDNcljvbGtCbaVLdQEn8EoZPioMDtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718419756; c=relaxed/simple; bh=Nowwrm7YYGZQB/wslBwAOshDqT2fPt36KDckIMemIKA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e4ahequi+UU4eER31/C53auN5NJBfhBqSSUEANSg+qVNNTvlIAuPxQNcW0oHKhR5dKMUPUPWRs1CbLEQi9JIdbbka/61p2vv0hWUU12h24sOx0jSUNJ+g3sBl4bx7ym8ArQQTxblSLIadw8BOEMZdJDeMTI6+O2K0PXCahMFbKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me; spf=fail smtp.mailfrom=rcpassos.me; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b=dlHYQq2e; arc=none smtp.client-ip=209.209.25.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=rcpassos.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rcpassos.me header.i=@rcpassos.me header.b="dlHYQq2e" Received: from smtp-out.flockmail.com (localhost [127.0.0.1]) by smtp-out.flockmail.com (Postfix) with ESMTP id 3D2E0E008E; Sat, 15 Jun 2024 02:31:30 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bvoD1xXUVp/wUtcoK6nxcw08qYW6ORI2TW5d4HCm9+A=; c=relaxed/relaxed; d=rcpassos.me; h=to:cc:subject:date:mime-version:from:message-id:in-reply-to:references:from:to:cc:subject:date:message-id:in-reply-to:references:reply-to; q=dns/txt; s=titan1; t=1718418690; v=1; b=dlHYQq2eA60KFCWcGwEWTdiBqXvlg4MQ3xh8ogIpAviCXWje1HO4SgBp+AMt1H/o2mixfI+o 8qJHfrIMChmg62q2X9OlpGNRKS4o308wvZWMjGPa/WziEEc2ufvPkwI1O2ubBroRBwC5KP1iIYR Lp6MhM2PBNRKOU8s5VmIl1ig= Received: from darkforce.pihole.rcpassos.me (unknown [104.28.243.51]) by smtp-out.flockmail.com (Postfix) with ESMTPA id 36B47E0047; Sat, 15 Jun 2024 02:31:29 +0000 (UTC) Feedback-ID: :rafael@rcpassos.me:rcpassos.me:flockmailId From: Rafael Passos To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org Cc: Rafael Passos , bpf@vger.kernel.org Subject: [PATCH bpf-next V2 3/3] bpf: remove redeclaration of new_n in bpf_verifier_vlog Date: Fri, 14 Jun 2024 23:24:10 -0300 Message-ID: <20240615022641.210320-4-rafael@rcpassos.me> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240615022641.210320-1-rafael@rcpassos.me> References: <20240615022641.210320-1-rafael@rcpassos.me> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-F-Verdict: SPFVALID X-Titan-Src-Out: 1718418690115887987.31293.5266191172157278976@prod-use1-smtp-out1004. X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=W6Y+VwWk c=1 sm=1 tr=0 ts=666cfd02 a=rO3HKV82O4ipXYUjDYeURw==:117 a=rO3HKV82O4ipXYUjDYeURw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=CEWIc4RMnpUA:10 a=yI5TgzhYSYgGwSC-jVgA:9 a=---8k2CCGq07aBBJLGWX:22 X-Virus-Scanned: ClamAV using ClamSMTP X-Patchwork-Delegate: bpf@iogearbox.net This new_n is defined in the start of this function. Its value is overwritten by `new_n = min(n, log->len_total);` a couple lines before my change, rendering the shadow declaration unnecessary. Signed-off-by: Rafael Passos --- kernel/bpf/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c index 4bd8f17a9f24..10b2ed6995eb 100644 --- a/kernel/bpf/log.c +++ b/kernel/bpf/log.c @@ -91,7 +91,7 @@ void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt, goto fail; } else { u64 new_end, new_start; - u32 buf_start, buf_end, new_n; + u32 buf_start, buf_end; new_end = log->end_pos + n; if (new_end - log->start_pos >= log->len_total)