Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5426799rwl; Mon, 3 Apr 2023 20:51:47 -0700 (PDT) X-Google-Smtp-Source: AKy350byOYfFVNDPcipK4q66exMoKVTACOm+O/pcGkpkHwroJzRBbhtR6JZrr7ditHicXb4DyJjo X-Received: by 2002:a05:6a20:8b1a:b0:da:fe31:d008 with SMTP id l26-20020a056a208b1a00b000dafe31d008mr1022510pzh.19.1680580307619; Mon, 03 Apr 2023 20:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680580307; cv=none; d=google.com; s=arc-20160816; b=dWqjHf7RbjDREc/OlFLd25Su9zQQxsWY7BSCV6u1jwF9xrNw4zP3t12hAU/g+Owd7+ cFIMvy8SzfmkKUWpdM81Atjad2XWBCDhX4q434du+Ysqr3Y+ajpw6po4FQK4p+U0gM4W x+Aa5hVPFHpcsco4DUZ9q/55gqXfVPFospidtinoJR3OS+bnPqDbQSI49GIC0yq8xAnZ cV/o0RJbSbfYRiaNxfo5kKTHjd0It+xURjgWn24bXKzMax2YS9876b9GhIwh8Ag1wcDa kzMNmuxpKWRyZ5nN9uzXT4l4laCEne5Wz7btWxUtvKA00E8Ju4ThXnX6UgTXvby1JaJE 4lpQ== 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=bPb/wMsXGsD9mO+QDpJF+O+Y+pq50wf4exUfBNMm/ik=; b=jZUuB3TMDDxCoIIeIIEGOW8gkXPIOhrR67Uqcy+uWAPMvuiFollaqPMF5E1OFDBLMO N50S7huzFtP1iC1nLNSB6kLnXxYqBReO+gAs2dccd+Ba/fnS2fy/8FupJA1/1q5WM4h0 Ae9C3BhGAofOk1dDsKLkFTIYXD09oMKoURghkxoEX5lgsJHc7h+vhjolHzLrU7k9mJLJ aKKU9hAGko7S3C0scgo+iNbZJ7agXdYu04O0WlSdZKIAp3f2ecJr+HLo9Fe3yOy6wkIw RTwbIHcIOdYqZ/TUwnW80X0tJjPPXy6oNhbxwLVsSmAI4dlB1sTE6I75WgGSTHXxokQ5 vNkA== 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 k32-20020a635a60000000b00503059b8b2fsi9239516pgm.220.2023.04.03.20.51.34; Mon, 03 Apr 2023 20:51:47 -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 S233234AbjDDDX7 (ORCPT + 99 others); Mon, 3 Apr 2023 23:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233249AbjDDDXv (ORCPT ); Mon, 3 Apr 2023 23:23:51 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DBEB19B3; Mon, 3 Apr 2023 20:23:37 -0700 (PDT) X-UUID: 005b3a2ee91641c09af50283789917b0-20230404 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:23d41e41-0d92-45a2-9317-dd453af336f5,IP:5,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:1,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:31 X-CID-INFO: VERSION:1.1.22,REQID:23d41e41-0d92-45a2-9317-dd453af336f5,IP:5,URL :0,TC:0,Content:0,EDM:25,RT:0,SF:1,FILE:0,BULK:0,RULE:Release_Ham,ACTION:r elease,TS:31 X-CID-META: VersionHash:120426c,CLOUDID:a5ba502a-564d-42d9-9875-7c868ee415ec,B ulkID:230404112333OFCV9LE8,BulkQuantity:0,Recheck:0,SF:38|24|17|19|45|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: 005b3a2ee91641c09af50283789917b0-20230404 X-User: gehao@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 947019076; Tue, 04 Apr 2023 11:23:30 +0800 From: Hao Ge To: pbonzini@redhat.com, shuah@kernel.org Cc: seanjc@google.com, dmatlack@google.com, coltonlewis@google.com, vipinsh@google.com, gehao@kylinos.cn, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, gehao618@163.com Subject: [RESEND PATCH] selftest/vmx_nested_tsc_scaling_test: fix fp leak Date: Tue, 4 Apr 2023 11:23:11 +0800 Message-Id: <20230404032311.146506-1-gehao@kylinos.cn> X-Mailer: git-send-email 2.25.1 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 stable_tsc_check_supported fopen but not fclose Signed-off-by: Hao Ge --- .../selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c b/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c index d427eb146bc5..fa03c8d1ce4e 100644 --- a/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c +++ b/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c @@ -126,12 +126,16 @@ static void stable_tsc_check_supported(void) goto skip_test; if (fgets(buf, sizeof(buf), fp) == NULL) - goto skip_test; + goto close_fp; if (strncmp(buf, "tsc", sizeof(buf))) - goto skip_test; + goto close_fp; + fclose(fp); return; + +close_fp: + fclose(fp); skip_test: print_skip("Kernel does not use TSC clocksource - assuming that host TSC is not stable"); exit(KSFT_SKIP); -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus