Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4011694rdg; Wed, 18 Oct 2023 12:08:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7nyv4txqhByRityXXsimn0DrAGVH3rqqSej3Qmh0pfgqdaaPCbT6AVxv3CZKaAwFXQLP1 X-Received: by 2002:a05:6a20:3d90:b0:17b:129b:1817 with SMTP id s16-20020a056a203d9000b0017b129b1817mr38068pzi.45.1697656098411; Wed, 18 Oct 2023 12:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697656098; cv=none; d=google.com; s=arc-20160816; b=ryPJjos9PyHN8cRonTwt8v7SiRbKk+UVy9DydUgK1jxQUbW6d7sTlmFdiPKLQbeda3 QmVrIIftHOOBQ59unhAirCPrmv7N9O4I7DQAmiAJG9mp9RhqaVgdWPjI96/hN2w5t1I9 f/F58JjDXSpvvS5DcMZDwXSGxksFklFNox1jhV6abZsoZRkV2JrHOExPZCJZiqf/eAee 8P+BuKjx4cS5O+/pR2nryE+gk7URMYFVtjSdvrlnaBzaIRfg8/aWPpK9wtBFLJeYprN1 RqlJXCip4rTcFZujW+9Uv/BBc3HTbYQxtND2maq5JpUPyRV/tgtw7R1dSlQR8pIpkSyq n1qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cEDDXOwUBOTP0ob0yPcID6lS1qUx48BjXcmqRUbCC3Q=; fh=EgnxcmRelXInL3uzpkCwc5eEWcoAJ/J2V2m1J3SCeOI=; b=vIgQn1X8JVLob4VmLTh8oi/2i7xjI7pkABYDAQykNsXlzKVGYic+G04182SVDAQE70 mmqri1PBRa3cddfXq/N1zQ7TJlzrJ1go5q4zFtBTwajk5vju+lrx+i28utjJiaNii0eE LnJMnaF1vk6iiPDZaufV5jwmi4TkxWp81oMHe3pCmr4Wypz0sIp3TQ+vXd2y/T/itwTU ZG23pXaAStJAGSXFNwnJEwuzLHqGaqnOPngGVgE4Bnb1eFwrm0X5MhtUiMVJhPyWxkGS 6N2MDtx7SWDR/6o7iDmjslkZD5gN0eIBz/pnpLTDsX+QEU4jqzouxgPPxSZyNZ+miRcE rnfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WGbJ8L3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f14-20020a170902ab8e00b001bbb39c68b2si499544plr.178.2023.10.18.12.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 12:08:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WGbJ8L3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8E84580FC0BB; Wed, 18 Oct 2023 12:08:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbjJRTIG (ORCPT + 99 others); Wed, 18 Oct 2023 15:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbjJRTIE (ORCPT ); Wed, 18 Oct 2023 15:08:04 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42BF11F for ; Wed, 18 Oct 2023 12:08:02 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7a29359c80bso59274539f.0 for ; Wed, 18 Oct 2023 12:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1697656082; x=1698260882; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=cEDDXOwUBOTP0ob0yPcID6lS1qUx48BjXcmqRUbCC3Q=; b=WGbJ8L3Rl+jtKoPsUhVoxw9U2g8NQtg8V9iaudGEQ3gnDn6j9PW+TpKRQIhGBFYma9 r6S1iiHcKRyNu1Zd+0IHesiyXRMaiCsFdHoisgCBrwyxXMaTqJ5cMdhRY4+dA2H9JC03 fv8U1e0y9HTgRCgy8WWC9ZHUXNVDsGGPJKNEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697656082; x=1698260882; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cEDDXOwUBOTP0ob0yPcID6lS1qUx48BjXcmqRUbCC3Q=; b=DNtGfc5adUE5yUXIXhCWdG8ColQOCjFrE58ICYggONmMZcdaFi9ZtQudgwXVCOlVEO dtQOIOzGPXEecInkmYdsyPoVTEuiKMZ2Mhn4n/dwJGfYbGUo4owRsaUyBLsk8ir+Pw/7 cddbGjBWjPy4tRH4gxJF/moLmmfD56YD2eSt7D9pNwYjN3D4c0TjgIJf7+CGMixJI0iq ga3s8vpAXouFhFJmopvhoZU+68/wLRfZ+SF5fKonYwQMaJYP/IxjpxPJEc42UtxJrZyt 6vMaHK7XkgtXgKbf58BeMHLwd5ZHHV3RxngrO2vSvvuDbQ7MwEVUytoCkfShc/Y2+6tu f4AQ== X-Gm-Message-State: AOJu0Yz9x0ZJtk+TuXm2bmAxb9sM3ONUk0l6iwaUzp9Yk/CYwl6HiS94 bUQW1W9ynA6fmZJz2djH7IFJIw== X-Received: by 2002:a6b:671b:0:b0:7a5:cd6b:7581 with SMTP id b27-20020a6b671b000000b007a5cd6b7581mr203528ioc.2.1697656082045; Wed, 18 Oct 2023 12:08:02 -0700 (PDT) Received: from [192.168.1.128] ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id 9-20020a5d9c09000000b0079199e52035sm269584ioe.52.2023.10.18.12.08.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Oct 2023 12:08:00 -0700 (PDT) Message-ID: <662a7ca4-beee-4ea3-b77e-4d5af1462f13@linuxfoundation.org> Date: Wed, 18 Oct 2023 13:08:00 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/efivarfs: create-read: fix a resource leak Content-Language: en-US To: zhujun2 Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, Shuah Khan References: <2a96e3a8-48a5-46ae-9a0c-b5f2def0a257@linuxfoundation.org> <20231018015921.16890-1-zhujun2@cmss.chinamobile.com> From: Shuah Khan In-Reply-To: <20231018015921.16890-1-zhujun2@cmss.chinamobile.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Wed, 18 Oct 2023 12:08:15 -0700 (PDT) On 10/17/23 19:59, zhujun2 wrote: > The opened file should be closed in main(), otherwise resource > leak will occur that this problem was discovered by code reading > > Signed-off-by: zhujun2 > --- > tools/testing/selftests/efivarfs/create-read.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/testing/selftests/efivarfs/create-read.c b/tools/testing/selftests/efivarfs/create-read.c > index 9674a1939..7bc7af4eb 100644 > --- a/tools/testing/selftests/efivarfs/create-read.c > +++ b/tools/testing/selftests/efivarfs/create-read.c > @@ -32,8 +32,10 @@ int main(int argc, char **argv) > rc = read(fd, buf, sizeof(buf)); > if (rc != 0) { > fprintf(stderr, "Reading a new var should return EOF\n"); > + close(fd); > return EXIT_FAILURE; > } > > + close(fd); > return EXIT_SUCCESS; > } Thank you. Applied to linux-kselftest next for Linux 6.7-c1. thanks, -- Shuah