Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1909910rwl; Wed, 12 Apr 2023 21:52:43 -0700 (PDT) X-Google-Smtp-Source: AKy350ZlNuRC+dpa+rdHfbMJAj7BLm99r574EJ6VhNNzRU6T+VnOaeH3neNIruDSQSIyqZhb4udV X-Received: by 2002:a17:907:6e18:b0:94d:e2ef:1618 with SMTP id sd24-20020a1709076e1800b0094de2ef1618mr528227ejc.7.1681361563597; Wed, 12 Apr 2023 21:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681361563; cv=none; d=google.com; s=arc-20160816; b=05aPUGSFgkA5O6bikZy2Osy9UtMCGR/j4fhR5RebICaKJFHVHZQoNi8k0IHz67dTEI UOgsixNNDj1WRVWI3OK3ziR8n4vQfD+Egz3JV/CmjPCdX2GUIa7flaXqo3vD/WgsDL53 Sixcr+gIT3PH4TJl0Xum6FnIHXrWWPkAvSdaxHDfirQaYzpcZ1yGDEKTcjXR8ACA8CJE x1JJ7VM2Q4FiCpTeOSFmXp6cj2UZEDSg7RN9p86CuEPB4plEX1ynaLqpu5fz56gA02lP dcMddfwnSYPA7mLduMBYXBWLf+j57Kkx1gnLVezv1zN9/iB/detJLzfdpr7WVST++qvF Dmhg== 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=GStT8v+5eiumZKQ7/ASq6rmIEXd03+9jCxGU8HLsp4k=; b=gVpqXHedsSR2dMKNT1cUSVylLvYuLd39hmnBgwuDY+x/9RqJHtWR0bbSUWHH2u4iud XPVKbmL+QxKQA0FKb3NcCHkHRgkeWXgMckSfRlGRvLL53U2iB1Z2tQBb0xQq1VvoCeF3 7ByYP8e0ZH674gfqu7mX3ABCRaPP5fV5zBGmRsd1zDoOmSOT9uGt0a70CRRMEMwxkRWT VbCoCVD+2pKDfijcD7VW7dTr/EC58w9oG8nJtfyQFEIITgPuODImF+sFRhFsKzjy4im1 wLVZqwj9e1gzYoipvkuTnvs0jM1BlMCgqkVYFC6IV02jg4wbpfgFo9juDfVAEEz2Fc2C StzA== 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 fm19-20020a1709072ad300b0094a89abe39asi1058231ejc.241.2023.04.12.21.52.18; Wed, 12 Apr 2023 21:52:43 -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 S229810AbjDMEqS (ORCPT + 99 others); Thu, 13 Apr 2023 00:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjDMEqR (ORCPT ); Thu, 13 Apr 2023 00:46:17 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A7059F4; Wed, 12 Apr 2023 21:46:13 -0700 (PDT) X-UUID: 88b58fc1a5574416af0bdbef49684799-20230413 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:1e4830ac-918e-4878-8fdf-8b271f98f3c4,IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.22,REQID:1e4830ac-918e-4878-8fdf-8b271f98f3c4,IP:15,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:120426c,CLOUDID:c9a9cdea-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230413124607FPIJEWCS,BulkQuantity:0,Recheck:0,SF:44|38|24|17|19|102, TC:nil,Content:0,EDM:-3,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: 88b58fc1a5574416af0bdbef49684799-20230413 X-User: zenghao@kylinos.cn Received: from zdzh5-qitianm428-a376.. [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 821352072; Thu, 13 Apr 2023 12:46:04 +0800 From: Hao Zeng To: trenn@suse.com, shuah@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hao Zeng Subject: [PATCH] cpupower:Fix resource leaks in sysfs_get_enabled() Date: Thu, 13 Apr 2023 12:46:02 +0800 Message-Id: <20230413044602.3221453-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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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 The sysfs_get_enabled() opened file processor not closed, may cause a file handle leak. Signed-off-by: Hao Zeng --- tools/power/cpupower/lib/powercap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/cpupower/lib/powercap.c b/tools/power/cpupower/lib/powercap.c index 0ce29ee4c2e4..a39ee1c89679 100644 --- a/tools/power/cpupower/lib/powercap.c +++ b/tools/power/cpupower/lib/powercap.c @@ -51,7 +51,7 @@ static int sysfs_get_enabled(char *path, int *mode) close(fd); return -1; } - + close(fd); if (yes_no == '1') { *mode = 1; return 0; -- 2.37.2 No virus found Checked by Hillstone Network AntiVirus