From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) (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 288394690; Fri, 1 Aug 2025 15:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754060815; cv=none; b=h6KuksFMnT74D0o02s1w1QfIiYhfQbtPvV1a4eWEwqtHvlO6xPIPKGMgVOGXe9hugxHvD3DsklQKAAaZeW/y3e2KhhNAd311PhzWh2/bnpD7y+VxEKsEV+whvdhYONkyLtw2UmJAG7LQczA8/1dZNLkUiE/BoutjV7YVaY/ydtA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754060815; c=relaxed/simple; bh=FeSzmhc+l8wzdVVICiIXjiyry8U2yzJa2vd0Fqm9dao=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EYwnOXnMdlgjEAe6SK2+m2cM/4hNCO/8fpxroqt/tlJ/ZVcDmK/f2s9HHLJ+nqOIPV9lQICzY4jSns+UnuFCRX7tbqAoEjCstcvbY4isBwRQ3osDuqwbKCgsqcXvhpJDiG1IknmFfqhKgso89bS7cU4mSvXY8txZFsXSXNYFTdI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6F5C9134010; Fri, 1 Aug 2025 15:06:48 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf18.hostedemail.com (Postfix) with ESMTPA id 8770F31; Fri, 1 Aug 2025 15:06:44 +0000 (UTC) Date: Fri, 1 Aug 2025 11:07:05 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: LKML , Linux Trace Kernel , bpf , Masami Hiramatsu , Mathieu Desnoyers , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jiri Olsa , Martin KaFai Lau , Eduard Zingerman , Song Liu , KP Singh Subject: Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put) Message-ID: <20250801110705.373c69b4@gandalf.local.home> In-Reply-To: References: <20250801071622.63dc9b78@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: 1rn64c971pqxcscrkufredpxzpd3fbqi X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 8770F31 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX19VM1qpXwNmASfQCgcyc9BZ5oAOw62RSyw= X-HE-Tag: 1754060804-145673 X-HE-Meta: U2FsdGVkX19NRXlTLfJajgaaKHcRPDQbGIFHR8AfWenPZ8ropJguBvV6cD6BLshkrbTZgh/aV5ekzBXhwyjXB3MvO44WkSBtjJ13RtI84pY6Sr5eIXKyIyrUW4NIyrDP2JIgGAG6BIJNj3RLjuZ9Pfn9Nc5bon3UfSAoBJsJdjBDVJmXFppLGqU4K3IPfoCT87xqeofem/GhCiSmeO2fCQ/FFocgPfjyjcvR4srIZRfh/Kj4sA9vEq3fIBlXOqGLftlYq5FazBAqg6pcYCnMday8JWmZChSVtIG5Mo25I56RxAZGLzNCS1b907VFuS0jCenimdQFkwSvT/vLPBa0kN6yUNIQj9PU On Fri, 1 Aug 2025 08:02:24 -0700 Alexei Starovoitov wrote: > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > > index 1d2cf898e21e..480657912c96 100644 > > --- a/kernel/bpf/btf.c > > +++ b/kernel/bpf/btf.c > > @@ -3788,7 +3788,7 @@ static int btf_parse_kptr(const struct btf *btf, struct btf_field *field, > > /* If a matching btf type is found in kernel or module BTFs, kptr_ref > > * is that BTF, otherwise it's program BTF > > */ > > - struct btf *kptr_btf; > > + struct btf *kptr_btf __free(btf_put) = NULL; > > Sorry I hate this __free() style. > It's not a simplification, but an obfuscation of code and logic. Well, it's becoming more common. But you are in control of this, so it's your decision. I wanted this just to get rid of the gotos in my code. -- Steve