Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp106383rdg; Wed, 11 Oct 2023 23:24:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN1XLu24+qgDqC8ch2Ukft5FAWc+sGCAvM9NlYZlJ2Rkx65jBcAc4Io5LuCp8iIpNqCQZt X-Received: by 2002:a05:6a20:1607:b0:163:61c:9275 with SMTP id l7-20020a056a20160700b00163061c9275mr26001395pzj.41.1697091874599; Wed, 11 Oct 2023 23:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697091874; cv=none; d=google.com; s=arc-20160816; b=qqdpyBmJGlhzjIrkHwyuBblX4D4Md1ej+QSfw0s1tRUMBXf7FHnEnTYBRqxtTW0DcG FBeB5whU0sAe/rK9DeBSBHS44CGI9R3lWc1DW7DDg1xJifTj7xDCzXBLT5sFOAclq2kl M0gzZevNi02zE9Ttqf+bK86Z30inJVOTKwUJciqcqp74T72VcEUZFj3OzQKIJDtkuo6I Om4Vpk3lxGRADW3huQ7DS9o06RkB/C01kuZmJeVW7DAVQmwQscfMpGwyQQCPDZZA+4zo UxF80LXrR8j2b7ADv7heCCElClswSY5Wc7XUy3b90SXhQDWI7F4MquXZTUF/UiRkKGtK uGMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=n22HctTeNabjvu+detFMoBE23ee2ZNJEYKUzOJUpCFY=; fh=d2c3GDvCFnEMjeV5/UdzkMgvIdbP06sIBDmJP5CjgvI=; b=itGTrBQOEsTrW5VrKfJFNdisXmDEjcRaneZ0tkqA7WX6b++VwjuZog34HmvdupP1Q6 yknltwy/3SFGCEy0VKHCmldM9mHf1SB/3bHz4QaTSe579gt6befNiNhF9ZVKwjG82xcH LKTiVtOoXWO2g60RIGZxsYbZvC+qllnTayYXnk5qQDFURXrLkiIb7QfK4fBwqpJciqt0 ajGRAKPRNzW5mnAhO055d0VrRtGoHZJA/bnTzSPeb8R+EMuYW5EN5B6yWG+miFYp8miI uGlzhj0zmXmab7u4TEQC1WyKh4pYVMKzJFlRtFQHuJHbuDJJHRgXFoxio/Kn4bTVrOHp TNxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HXoEglfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b17-20020a170903229100b001b556b0d0b7si1648522plh.480.2023.10.11.23.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 23:24:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HXoEglfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9C5058212A9E; Wed, 11 Oct 2023 23:24:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377629AbjJLGY3 (ORCPT + 99 others); Thu, 12 Oct 2023 02:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377424AbjJLGYU (ORCPT ); Thu, 12 Oct 2023 02:24:20 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C7DC9 for ; Wed, 11 Oct 2023 23:24:18 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5a7fb3f311bso6740157b3.2 for ; Wed, 11 Oct 2023 23:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697091857; x=1697696657; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=n22HctTeNabjvu+detFMoBE23ee2ZNJEYKUzOJUpCFY=; b=HXoEglfzw+KwzhCEAFNDf4mqZlbE8tAGIMFRp7swMbFlWFhUHWTJDA1+Fbeo1kW3U5 kVOVtIBUXXtIpZs+Tdib7mDnhulG2AyUdxFCFUeHLvtf5SrxhYwBN6nQb8k+yq3IW2Au J5PvYGoww0AgGz0cVoQQFlNsneoJ8L2W1MEG0/km7lMezsb/6nD+7K4DbeamiUXnnbJx F5mQk08VtBjjfIJb19lvS0QkMObyiLZ1rkG9/ppT/L07aNxl5aNfmgWwrhXb7woiN785 iW4D9oWg5eoPPuZYDAk6ddTsOkEIZESU6MBdwlD0KgDd5mQnAf8ilcFIighszbsuZcSe W1/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697091857; x=1697696657; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n22HctTeNabjvu+detFMoBE23ee2ZNJEYKUzOJUpCFY=; b=HJAXCGkXnEUqo8C7uze1PuTwnVkGuVgbdlGDmRAcLxB6M/BwQWQNGEyLHt9v1CgNpq Ei2Pv5NkwAo0Xm+hiUTmZrCp+iykzvvET07Nj4mJk5+R7A5SoQTrbyXLZz/1j+8AbTRm mTu0+6G90nHgYLqelMFx3m2x3AbF97UFz0Rl/i2VmsyocYqGvBybxG7Y5MrmePZGSMZm kugcuyw5OU1vucUrgom6/g0n5CA8UhmGKpmbME91fjmVVx4CsyzKbaIGjX1S2z+vC9ep CkJZpFVztHZwEQT8maiP9IBNW9mkJ3l8WrG/z1YrSf3JUiWVlLQqKt9jtTSf1UpR8efn X5PQ== X-Gm-Message-State: AOJu0YyClvz0me0VRHYIeEtE8hiP72245nrNblL0ld7WdX5AHTnXM+/Q PJOo/juF78NOR/cUr8bU4v6B4mv/YV2/ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7be5:14d2:880b:c5c9]) (user=irogers job=sendgmr) by 2002:a81:a8c8:0:b0:592:7bc7:b304 with SMTP id f191-20020a81a8c8000000b005927bc7b304mr446341ywh.8.1697091856969; Wed, 11 Oct 2023 23:24:16 -0700 (PDT) Date: Wed, 11 Oct 2023 23:23:51 -0700 In-Reply-To: <20231012062359.1616786-1-irogers@google.com> Message-Id: <20231012062359.1616786-6-irogers@google.com> Mime-Version: 1.0 References: <20231012062359.1616786-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Subject: [PATCH v2 05/13] perf offcpu: Add missed btf_free From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nick Terrell , Kan Liang , Song Liu , Sandipan Das , Anshuman Khandual , James Clark , Liam Howlett , Miguel Ojeda , Leo Yan , German Gomez , Ravi Bangoria , Artem Savkov , Athira Rajeev , Andi Kleen , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 23:24:33 -0700 (PDT) Caught by address/leak sanitizer. Signed-off-by: Ian Rogers --- tools/perf/util/bpf_off_cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/bpf_off_cpu.c b/tools/perf/util/bpf_off_cpu.c index 21f4d9ba023d..6af36142dc5a 100644 --- a/tools/perf/util/bpf_off_cpu.c +++ b/tools/perf/util/bpf_off_cpu.c @@ -98,22 +98,22 @@ static void off_cpu_finish(void *arg __maybe_unused) /* v5.18 kernel added prev_state arg, so it needs to check the signature */ static void check_sched_switch_args(void) { - const struct btf *btf = btf__load_vmlinux_btf(); + struct btf *btf = btf__load_vmlinux_btf(); const struct btf_type *t1, *t2, *t3; u32 type_id; type_id = btf__find_by_name_kind(btf, "btf_trace_sched_switch", BTF_KIND_TYPEDEF); if ((s32)type_id < 0) - return; + goto cleanup; t1 = btf__type_by_id(btf, type_id); if (t1 == NULL) - return; + goto cleanup; t2 = btf__type_by_id(btf, t1->type); if (t2 == NULL || !btf_is_ptr(t2)) - return; + goto cleanup; t3 = btf__type_by_id(btf, t2->type); /* btf_trace func proto has one more argument for the context */ @@ -121,6 +121,8 @@ static void check_sched_switch_args(void) /* new format: pass prev_state as 4th arg */ skel->rodata->has_prev_state = true; } +cleanup: + btf__free(btf); } int off_cpu_prepare(struct evlist *evlist, struct target *target, -- 2.42.0.609.gbb76f46606-goog