Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6278356rwl; Tue, 4 Apr 2023 10:07:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bHfcteoiOVZKqkwkE6PNio3EXjCgTZHzbX9H6JsVqsmi8055QpHCnb4dqqxVtns8TSCqWE X-Received: by 2002:a05:6a20:3aa6:b0:d9:5a7c:b1c5 with SMTP id d38-20020a056a203aa600b000d95a7cb1c5mr2786635pzh.11.1680628047994; Tue, 04 Apr 2023 10:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680628047; cv=none; d=google.com; s=arc-20160816; b=lrq3FLth0+XR6uC01lC8N5yu3CCH+gLFDbYe8ZHD8wGvCJ2nkG7FuBA64ZxJ9D43rK u33o2c9QQi+46T9yxyjndLRAu30I9biDvFxAsVxwIIGYZifBT5YZ+9FYN4DlCf/wG66k eHCJdOE++VYIby3inJO92iaqZV88OH+II3Wc1AoDhjwNekcapmsXHHIOG8p87WcNVX3C Ky5aeodmOcrBssA16DctzX7TvtULsWO3lwfbFg+Syex3mb3Y+ubTREtLukr1yVYWEGN9 e0nNn6ocnhL8+z7rFcZFL+w6wgCatr1bfJoHOdLrMmG+DqbUgVjlERY/9FC5DfjhhFe8 CVMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+M9AvHAoqRC62i9d3G/DOubPisEKm8TEzbug9rmEdMY=; b=SQkAv73og0m17+WwkEpNv9CzpTNTJRT1IbWq29QssShob9CJKjoBtNgluE1g1qRaDc 5uYn2jlS48M8fNo9R5f3fXFJ83MjUz3G/farDGctSNckDUV9BQ5Oc+ScSXhsZvUWxdn/ uQiWHXWcWvTIN0puyLeWiB64FMu0QmEnJjax74GsCnl7a7ZL9pmlcl2TjTZVBrQqUeZt Wr1DvhTHv9EmgzwTgxHHKAmTfmuDCRxEqfQbGb6WCjPcJFQzet/5xvLemoRDy+g6BfQo YSIRaV53uvoGpstRKfKnD7k91vyi8lAR+eIUOclZS0pO1HqzKNT4CS/JYHvKI/InEgzo htQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PWkaJuH8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y67-20020a636446000000b00513601ad3cesi10679837pgb.150.2023.04.04.10.07.13; Tue, 04 Apr 2023 10:07:27 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=PWkaJuH8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234402AbjDDQ7p (ORCPT + 99 others); Tue, 4 Apr 2023 12:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbjDDQ7n (ORCPT ); Tue, 4 Apr 2023 12:59:43 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0058BB8 for ; Tue, 4 Apr 2023 09:59:42 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id d3so11612387ybu.1 for ; Tue, 04 Apr 2023 09:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680627582; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+M9AvHAoqRC62i9d3G/DOubPisEKm8TEzbug9rmEdMY=; b=PWkaJuH8u5Q/hy9Fp7MvpFk8hSAodOXWzwkbw211lCE9HVJlRG0fhNGdfRkWWBSbrQ Ly41tFgckBhJTguoHbKG3jmdlEjEpuK6RS5Sw2uV5VUiOqhc27REHiyKTzpyiucNrWrw Dx+ZExsODNz1e9AMO+Dzc4H7oXjuVBgjJONLyJ/fVF6FJLs81Ww2Dezz+hz8f/F8MrOM oNMnX78N58o486HkPfgdLIM9CrV0PHUn/16hX1z0aFlqhF8PnT3eUm9VLcI6Y8kEE149 4d5ylfFpnU+fZWmly4YwdBwdX8yOjT97bUXrSVz5wdSqAWxtC8xs37j1OqVaBur6+kd1 Z0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680627582; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+M9AvHAoqRC62i9d3G/DOubPisEKm8TEzbug9rmEdMY=; b=4mmITk8FAgDLAYSCb713CBtJEHDr4lmETpr5Dc84OWwNmCXuNRYr1/l7ZULGciru30 tj9yNS/eL3LftCMmT01T6LZGGpEaWQPYGcZjn4tvhWlJmGDMGbnTegKd+qRw3Z2oGxzP 9lydbD1GWyYcxjVWTun2/2XwGsGQgMdCOE3fcWnh6JqzQrz0O4tMoHc2NC67Md+0H+H6 Bdl2Aq721Tru/faSzJCv0QvRtP+utTJBZvss/6CF0phVDghOM0xoL4Lswl66aSYZbP/6 Tect18wqDT0tKrf3zOWUxr8IttDokenMr402qpgaZa4qGo2988qPmTxrRkDcbXkVLSRA IWuw== X-Gm-Message-State: AAQBX9djNdVa2elJ+cBpk+k9O9wvWED5wtSPtxiAzpZ0asNRsp/a4U5M W6+IykzksEgclyZRLffaTrQrIWC2F9BfKjdKwLpDpw== X-Received: by 2002:a25:9:0:b0:b26:884:c35e with SMTP id 9-20020a250009000000b00b260884c35emr45420yba.4.1680627581890; Tue, 04 Apr 2023 09:59:41 -0700 (PDT) MIME-Version: 1.0 References: <20230404032311.146506-1-gehao@kylinos.cn> In-Reply-To: <20230404032311.146506-1-gehao@kylinos.cn> From: Vipin Sharma Date: Tue, 4 Apr 2023 09:59:05 -0700 Message-ID: Subject: Re: [RESEND PATCH] selftest/vmx_nested_tsc_scaling_test: fix fp leak To: Hao Ge Cc: pbonzini@redhat.com, shuah@kernel.org, seanjc@google.com, dmatlack@google.com, coltonlewis@google.com, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, gehao618@163.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-15.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 On Mon, Apr 3, 2023 at 8:24=E2=80=AFPM Hao Ge wrote: > > Fix stable_tsc_check_supported fopen but not fclose > > Signed-off-by: Hao Ge I will recommend to expand the commit log to something more descriptive lik= e: KVM: selftests: Close opened file descriptor in stable_tsc_check_supported(= ) Close the "current_clocksource" file descriptor before returning or exiting from stable_tsc_check_supported() in vmx_nested_tsc_scaling_test > --- > .../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_te= st.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) =3D=3D 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 h= ost TSC is not stable"); > exit(KSFT_SKIP); > -- Other than commit log, Reviewed-by: Vipin Sharma