Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2675380rdb; Wed, 15 Nov 2023 07:34:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjideJAbdCrB00MGolQkQvmGIov932MRusJbfwrlOX5QBzVjNyA07Hw3nhZKDiSYgbYN69 X-Received: by 2002:a17:902:d2c3:b0:1c8:8f5f:b610 with SMTP id n3-20020a170902d2c300b001c88f5fb610mr6501644plc.13.1700062466069; Wed, 15 Nov 2023 07:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700062466; cv=none; d=google.com; s=arc-20160816; b=fJ0uYy0j/YLY6GYMNCWWXfX8ynfSOitL35411N4hdYdFidgeuqalztvK8SdOAuG9qS zAci8guG+SybjMntRtuESuCaBrzNrfOeWQvE9i23cToYzxOJ54ho9lwuc2h2l+2Kw+Lm M52KIkV9CqeZ8utb23KY0ETea9oPZIAymYbZ/omu2bj+exkQdz2WzXKcFTXX3RMnOO53 RVEBKddvzxiuHRtN2Yyn1JAyI8mCF5+6G34GHes/dbqDR4+OYS+EsODoCm6861/ZLzkb E1PUz92mxbCobFFMzzyaVvr0A0fiuz7e5MqxdPXZuWXy4+RmexgYp8p27A/wehfwgqe5 WUbg== 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=eexl67/czdrpXkTA9o/c6ZVoCaffuycfXirxMi0NJeE=; fh=Z1NwI/cekpoOEJzojkuWMIyl44abhsN1Km6Jo7+h1eQ=; b=DlP+MdK8SgX2S6LdT74K1hf+Hc3Hcf4VQWsFUaBx5ONVu+rHbQGZ+jNupLpTBj1gYg vukLQ5MthTpeOO+GmWnkKVwiKUS2TzMCMr9suhHfaHUrK/tvW/sIc/UnecquJx1IJv6a VmxHq9g5/jbOkjDd8mnG3MRnZu5Mdvtz9K1nyk3uvRXVhVTjvIb0rbH/A+/J9C1oCnvz fDqz4E6bb3REHjYSg4HOFv0xeK++zIiD7FJOOVWf9ae1GMuyRWVWsMDAoDYsI549uzx9 nsguRhk9MyZDd59Ru2CgFUaFEQRuB/Q2EoPR78voDw8FoQpGpQmvsplo7vlbQM2AlxBM fh1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=iU09SIHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y13-20020a17090322cd00b001cdf9442d20si11048605plg.336.2023.11.15.07.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:34:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=iU09SIHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8203C8085985; Wed, 15 Nov 2023 07:34:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbjKOPdy (ORCPT + 99 others); Wed, 15 Nov 2023 10:33:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjKOPdw (ORCPT ); Wed, 15 Nov 2023 10:33:52 -0500 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C81101; Wed, 15 Nov 2023 07:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1700062428; bh=0NwkqGMmlxRkONEuO4KbmE3UnNfjeoUyBXz8wtpcI6I=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iU09SIHBmcpVTgbcYJxzjAW/StJk21020JMEkRL7HtMXPbIQrZRdc6PDKNjk79RmF 84AQ4X1+tnR5rLk0bzgNGLV6BHCCKqpFULgwcv/i3Oi2fgX/X9vU8b1I26Y1tISWuI WWsS/WG3PrtXOvhiAua79ZxfMQpmHNLcAxYSOSnWcrNeiB6ytB6YCgykv1ldzxJ1Rh 2IYLNTeUNTDsOAeZwHEY/i2jxEPpgR8YIKk7NWdJyMRiz5MnGnASJIdssBpYPXbNtL 5BrGbUiQ/ZMdsAkf1l9MscLC4IZN39gBEewmbo5HPgNEaUbaLsSTmQEfKkyiR1Cy81 sXybTB4xdCvTQ== Received: from [172.25.85.137] (unknown [12.186.190.1]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4SVnJD4Zz9z1cB6; Wed, 15 Nov 2023 10:33:48 -0500 (EST) Message-ID: <8431b227-d053-4a9a-a278-2a43753fdaf7@efficios.com> Date: Wed, 15 Nov 2023 10:34:16 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/media_tests: fix a resource leak Content-Language: en-US To: zhujun2 , shuah@kernel.org Cc: ivan.orlov0322@gmail.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231114093812.7169-1-zhujun2@cmss.chinamobile.com> From: Mathieu Desnoyers In-Reply-To: <20231114093812.7169-1-zhujun2@cmss.chinamobile.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 07:34:05 -0800 (PST) On 2023-11-14 04:38, zhujun2 wrote: > The opened file should be closed in main(), otherwise resource > leak will occur that this problem was discovered by code reading Fixing resource leaks for one-off test cases (processes execute and then immediately exit) seems to be something that would fit in the definition of "trivial", so I would advise to perhaps send those patches to kernel-janitors@vger.kernel.org ? [...] > + > + close(fd); These added calls to close(2) miss handling of possible close errors (check return value and use errno to print an error). Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com