From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id E0CBC1B3DA for ; Tue, 6 Feb 2018 01:16:39 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7B95A20C76; Mon, 5 Feb 2018 19:16:39 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 05 Feb 2018 19:16:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=TReOaEhEqSqwiqRLZl9Y00ygZU 1NUf7DECO3gbtvB6g=; b=AKXsYY09Z6wgTnIKPyhk4wj8B3NJJjAza7Zt3rp49x QhJfAxH7bs8fhjUMwXZPTp4Bn3ljYnV0MEBjs0FEzQQwv30m2I0MVhio2UvNehIq SAV09r0pSfGzC7q0vJGvOnv8ab/PO4LUJEeueR2exOCv7twSDO8voHJoLMzygIyg o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=TReOaE hEqSqwiqRLZl9Y00ygZU1NUf7DECO3gbtvB6g=; b=LeXEgYjYEyHby0Hbf4tQHT D/smODiP8AEPOfCkGIFZ60uUcqsE1nva6uWUbrRN9YZdz5xbAkq24V9gVYR0uJqF +PBZ4+MPUQnD2fhML5HoSaV6fogcPSVWnxYI4S8YBZWZLolGe5Rt0RaEt/7veO+X G+cxRSF00RCs471Qy25rMvyW2K1iJVjzjYfTmz3hO6eZjqHJQuYt0EcXur+m/Bd7 1+1ICXviNScAvsZ4+68hluRgv1l7k0vHmzskBNkdvlZu5oOPyzqHX/6VOWlFWK8N sdjbfM4HnREXHQEVw4IRPJk3R57jqaxXBG+nXkdPmBrSHh6yG46TYftA6eyTkF+g == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 25B777E3DF; Mon, 5 Feb 2018 19:16:39 -0500 (EST) From: Thomas Monjalon To: Bruce Richardson Cc: dev@dpdk.org, Neil Horman Date: Tue, 06 Feb 2018 01:16:35 +0100 Message-ID: <2667705.0fuXX6fmai@xps> In-Reply-To: <20180202184721.GC21773@hmswarspite.think-freely.org> References: <20180202120058.243184-1-bruce.richardson@intel.com> <20180202155112.GB20444@bricha3-MOBL3.ger.corp.intel.com> <20180202184721.GC21773@hmswarspite.think-freely.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] pmdinfogen: fix resource leak of FILE object X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2018 00:16:40 -0000 02/02/2018 19:47, Neil Horman: > On Fri, Feb 02, 2018 at 03:51:12PM +0000, Bruce Richardson wrote: > > On Fri, Feb 02, 2018 at 03:47:43PM +0000, Bruce Richardson wrote: > > > On Fri, Feb 02, 2018 at 07:44:39AM -0500, Neil Horman wrote: > > > > On Fri, Feb 02, 2018 at 12:00:58PM +0000, Bruce Richardson wrote: > > > > > Coverity flags an issue where the resources used by the FILE object for > > > > > the temporary input file are leaked. This is a very minor issue, but is > > > > > easily fixed, while also avoiding later problems where we try to close > > > > > an invalid file descriptor in the failure case. > > > > > > > > > > The fix is to use "dup()" to get a new file descriptor number rather than > > > > > using the value directly from fileno. This allows us to close the file > > > > > opened with tmpfile() within in scope block, while allowing the duplicate > > > > > to pass to the outer block and be closed when the function terminates. > > > > > > > > > > As a side-effect I/O in the function is therefore changed from using stdio > > > > > fread/fwrite to read/write system calls. > > > > > > > > > > Coverity issue: 260399 > > > > > Fixes: 0d68533617e3 ("pmdinfogen: allow using stdin and stdout") > > > > > > > > > > Signed-off-by: Bruce Richardson [...] > Acked-by: Neil Horman Applied, thanks