Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2077205rdb; Mon, 9 Oct 2023 11:41:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkzzG0IDMjr3o2zyMtHhq0MKR7UkJ4lgU7bh9c7mOwILU6PaRTAqDoMnuEO46GoVFkH5ZR X-Received: by 2002:a17:90b:4b84:b0:277:422d:3a0f with SMTP id lr4-20020a17090b4b8400b00277422d3a0fmr20292880pjb.17.1696876883873; Mon, 09 Oct 2023 11:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876883; cv=none; d=google.com; s=arc-20160816; b=r3SRHi0Xq3jqUIKpR7RnFk+scxGkXHROkXnAg+72CaXdxDBRttew0QqcC7yDO8zjej yL6G1/TdYE0i39h3be0/poS0W8+ZTvV/4OMJxSd0VhYlZM48ea6Rog4nYIcHCf8teeuX JA2KfnC22oN3D0Z+2R82rBJC4oatkK71oHsoCorPDFI5iaZSSIHo6je8kB2HKRkodFyF NRHHXd/IDmvXLHevf64RKsR0zF0XWGkKsFAlzVx/xoxCqIU58ei9QZP8rSawg12hf0em ERvpI7zEeI6JhvPBy8fl1bl6SYePLSG1gPa30WwxjwMevIR9cysnJzpuQqeD1T7xX11V cGrQ== 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=oxVOZd3C3ppqYjNmukwrdUncP0WHK7JyRq4ciQhpawI=; fh=8uoRd8OfBKdrcgzCS0TCbKG83gg6rx5b6zeE6Tx82zI=; b=CvtUCu/IYifH5HFpPtnswi3lUfuXHUeRioYQ8Ptji5jRXd2IzotqnGHuggavJNrsMN E+8wdEaoPitjcA0e++ai0N2S8Oc/jpffOFU5g+isTqta5+AIeJxLWU5JQhnIplQNzFnB EV9601cdEDgLnICaBLI/rubIZ/W6fW7H//vg2Md59RVUzVL7lRNH9DDn6D1usuJJ2jiV 3dRsMOYbJ+NASRvijzAUAZXwQrbAedP+j+CdMZXR741fLiIc5O4SZir3BNkAkdE43mYH /qx6c5zj0I0Ezz+tgroTi0uv5YT58efnyAIVYTrRcCFAYyei9tUKVx28LfYeI11dL4ZL ralQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Zzs8LgYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id mq4-20020a17090b380400b002689d34ae8dsi12738678pjb.18.2023.10.09.11.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Zzs8LgYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 9349281CA643; Mon, 9 Oct 2023 11:41:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377392AbjJISk7 (ORCPT + 99 others); Mon, 9 Oct 2023 14:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378343AbjJISkY (ORCPT ); Mon, 9 Oct 2023 14:40:24 -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 0B311D73 for ; Mon, 9 Oct 2023 11:40:06 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59c0dd156e5so81024937b3.3 for ; Mon, 09 Oct 2023 11:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696876806; x=1697481606; 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=oxVOZd3C3ppqYjNmukwrdUncP0WHK7JyRq4ciQhpawI=; b=Zzs8LgYxJ9L34/UUsH7V6H7bLUTX23gvXUy7Mis7bsgEZ1NHQFm7Xqx5y1ColHjZmU C5XoV/I7JmmKjC8RHUgdjBJF4jz11xylRZuMCUxRrIjLk0aM9jQp0mu5lZuoxzGwfMUH CTkWcQDEyc4/7GTBB/xlNduPGC5VzbIfZKILSA1Co9c6Vlb2bczlCQ5sDNgX4Xrp6jed xssAASOpyGbH4IkmXmfMNO6xc7upBOnVq4T/GwgWkDa6Vs1G8eDLpdcFq2qkiB0D6ip+ yKNhbpiGaK6J5rBJnhLOihTl/TUyZuzmHj5j1BbDJVf0pcQ5uszG9XaTkEmMqUDv/aZ8 bJSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696876806; x=1697481606; 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=oxVOZd3C3ppqYjNmukwrdUncP0WHK7JyRq4ciQhpawI=; b=lBhJekOucsMCM8FDPs8K0RJFbbYDdiNLiSO58UkB1F8hP8kAPHDW0ndZ0tA5tXsjS1 M6OanwSV1zY1ln5s/EYWuNtkkz4BSeIfbKtwWrouJRO4+586fn1UJ6N85IyJxMrWGnNR xj7Wh+Xy39ZQ3NZBDERR+ZgT1O1ET26uYbqSB786dBZTHOfNj00S94oyixCxEVoFFRGf hqN594h6qef/rtwuLvQmwpR2cZhnlIsNJXanphAHqfKJH+52inb60kJb5/iIyuy+1e89 wAV+1ZoMzjKGFdYZQiXdjTfdbjqyvkU4c7nrbN1KquzUajYWuQY/mU6ZQ864bSQ8TO4R ngFg== X-Gm-Message-State: AOJu0YzLusUhFcn/Jeoyv/mjBilcFwzAelnwIPX9Ds/vRfOoIqjEQZ7q KsUqI4Uu/os+SNCDucWwhRh1bNg+7wUF X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:ac4a:9b94:7158:3f4e]) (user=irogers job=sendgmr) by 2002:a81:4c4b:0:b0:5a7:b496:5983 with SMTP id z72-20020a814c4b000000b005a7b4965983mr17187ywa.9.1696876806075; Mon, 09 Oct 2023 11:40:06 -0700 (PDT) Date: Mon, 9 Oct 2023 11:39:18 -0700 In-Reply-To: <20231009183920.200859-1-irogers@google.com> Message-Id: <20231009183920.200859-18-irogers@google.com> Mime-Version: 1.0 References: <20231009183920.200859-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Subject: [PATCH v3 16/18] perf trace-event-info: Avoid passing NULL value to closedir From: Ian Rogers To: Nathan Chancellor , Nick Desaulniers , Tom Rix , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Yang Jihong , Huacai Chen , Ming Wang , Kan Liang , Ravi Bangoria , llvm@lists.linux.dev, 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=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:41:21 -0700 (PDT) If opendir failed then closedir was passed NULL which is erroneous. Caught by clang-tidy. Signed-off-by: Ian Rogers --- tools/perf/util/trace-event-info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 319ccf09a435..c8755679281e 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -313,7 +313,8 @@ static int record_event_files(struct tracepoint_path *tps) } err = 0; out: - closedir(dir); + if (dir) + closedir(dir); put_tracing_file(path); return err; -- 2.42.0.609.gbb76f46606-goog