Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5212647rwl; Tue, 11 Apr 2023 02:00:44 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxKKctuRaYsVz5pp6a/PHokUMoq0ldkTe3i/5dzRi+vYMVgBGmPTGBD9CEoCrKE6+xvi66 X-Received: by 2002:a17:906:bcf0:b0:87b:e105:5d9a with SMTP id op16-20020a170906bcf000b0087be1055d9amr7865995ejb.67.1681203644310; Tue, 11 Apr 2023 02:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681203644; cv=none; d=google.com; s=arc-20160816; b=cU0EQHhKVlad1779NarZVJZ7B2Ch6MkM/bVnyp7adaq76UVBOckDK3KNaJxFYc4YOO eyY8F33/yG0274nF9NSWRbO9r99XiJXaqILiEfLMb/d5gVdDJNrpBIxa2Sh2mQ3ih5ra jdMjj8SjtK4g8b5WZCPBRbknkVLsujAIf6lG09iAYsq/EPVo7jXv2YXfQDTYVfRku98p QOtDw4iwuDIkLe2drFxlFoT3q1YSx2omxL844WxUkB1Me7DDr+p3Gih4nZpgJCbYqJqe o8YBfr337wLhr8QVeRkWiJ3JhqiCO0xxh9qXAPNy/PonIeRQGMNGdBrvf6dB8uc4wRTh 15nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CBtEBDEZ9QwcMNm5lZuBtoWxWF0QiUCZj6feC8a2Mks=; b=dmT9VBdR4t7t5zP0YF07paqxEWUosDjnC2IbmHyjBwy6GgnrYLV/r9iFhNwO000D+y VuYZixYT+lJ6uvjxNPR0u0byFbie7tEKI9C2Soannoctu08IGD/SPeNzEaQR0hbwhJ+V Ame7i6VtCv4oXjQw382r7Q7z7/zZMcdunKiCBHSxq4yxkmFJIiyOvl3MC1gjmPpOL5GA ExU63Z7HHZlz6RciBTWaSr6kd1a64GhCy6XbvgncY3ZJ1749In7fsnoB2UJIPRDO1nAH w1rHgbu6EdrLejrlPPwE4OshQeLujbxsiDWJUpSiHosWjhOP6hA1mhkH4J9/ylu3hAIq MO4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ta22-20020a1709078c1600b008e65505a1ebsi769229ejc.0.2023.04.11.02.00.19; Tue, 11 Apr 2023 02:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229814AbjDKIoB (ORCPT + 99 others); Tue, 11 Apr 2023 04:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjDKIoA (ORCPT ); Tue, 11 Apr 2023 04:44:00 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E33AB; Tue, 11 Apr 2023 01:43:59 -0700 (PDT) X-UUID: bfd18483618a4ec99dc15cad0685567b-20230411 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:427ba445-c29b-4940-ad7e-f76af801a9e8,IP:5,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:15 X-CID-INFO: VERSION:1.1.22,REQID:427ba445-c29b-4940-ad7e-f76af801a9e8,IP:5,URL :0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:15 X-CID-META: VersionHash:120426c,CLOUDID:0a8cf1a0-8fcb-430b-954a-ba3f00fa94a5,B ulkID:23041116435292S8P2A7,BulkQuantity:0,Recheck:0,SF:38|24|17|19|44|102, TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: bfd18483618a4ec99dc15cad0685567b-20230411 X-User: zenghao@kylinos.cn Received: from zdzh5-qitianm428-a376.. [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1841137386; Tue, 11 Apr 2023 16:43:52 +0800 From: Hao Zeng To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Hao Zeng Subject: [PATCH] samples/bpf:fix fout leak Date: Tue, 11 Apr 2023 16:43:49 +0800 Message-Id: <20230411084349.1999628-1-zenghao@kylinos.cn> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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 Fix fout fopen but not fclose Signed-off-by: Hao Zeng --- samples/bpf/hbm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c index 516fbac28b71..7f89700a17b6 100644 --- a/samples/bpf/hbm.c +++ b/samples/bpf/hbm.c @@ -315,6 +315,7 @@ static int run_bpf_prog(char *prog, int cg_id) fout = fopen(fname, "w"); fprintf(fout, "id:%d\n", cg_id); fprintf(fout, "ERROR: Could not lookup queue_stats\n"); + fclose(fout); } else if (stats_flag && qstats.lastPacketTime > qstats.firstPacketTime) { long long delta_us = (qstats.lastPacketTime - -- 2.37.2 No virus found Checked by Hillstone Network AntiVirus