From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 871072C09 for ; Wed, 20 Apr 2016 11:16:19 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id v188so194714673wme.1 for ; Wed, 20 Apr 2016 02:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DvSDgOdfypN8oUgbYNS8vfy3uJfh7C1CZBXibc+S/tw=; b=CILQmHSOXcTzJQImM+I73k8ZpKuUtNV2fFmcpJWwEZa6WbdSrJ1jN8zAFFaQSNFxMo QwJAJmQalor7jf8Njhvgk6lCdKgOQEmqW+8v7V/V92DPLHs8k/e41alDJ5NpPnwdMcmb bSFadly1j6Pall2Bv4B+UArzDKOt5dR6JrgJa7Jl3pU1iWOjjNpgLKgqvlcbqECGWD6i HlGYslzfWsNb30goMKcLMPizfIf4adESfOy7up4gEfVMVqeS6vmD030y/FynpLXwmmXT 52dqtC+kGH3FKjAh65z3nI7yx9PJbOSHnCc5AbQI29aQcajWgzlz4bcQ3YOUkOPU6shA jjTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DvSDgOdfypN8oUgbYNS8vfy3uJfh7C1CZBXibc+S/tw=; b=dcwViOQRvTGIJuc+0jbpXvOSbTs/1MESeFn+onMLl+99RCsQM8j6AZkiZlDo4wB/Xs WE9PN3uiYEsj26GBiCmu8GFe/mh1uGLN1PtESXTS8hy3mU7/VgiaD5J89XnH+LPuJKSS gKkmcbg5a8nKlhbZ0/4LxW/dWeNTtFp+d1EqRFvia0kpJIB8sqcDY6q0XefCjegKnlAP Za42oEqM5cjeiXxrKIreogwS3c07KitDJUl0BF74i6FWLuzFLtFzvSbafksDEZtxPvMK y1AEOs88jSadrduzbOsdei5S99zwlH0Vd1KcgXpXqAn4vXAKZn3uFUo5GkNPuJnNghb7 fDsA== X-Gm-Message-State: AOPr4FWKVMVdj1cagHJrbw4Mu+dcsxa/pjjcsUY+asukFApsOAmj4/YCEZHslAq5/4BpWENUct4mmDs5kjYKfOOe X-Received: by 10.28.73.66 with SMTP id w63mr8313144wma.53.1461143779305; Wed, 20 Apr 2016 02:16:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.96.2 with HTTP; Wed, 20 Apr 2016 02:15:59 -0700 (PDT) In-Reply-To: <1461083251-31140-1-git-send-email-marcinx.kerlin@intel.com> References: <1461083251-31140-1-git-send-email-marcinx.kerlin@intel.com> From: David Marchand Date: Wed, 20 Apr 2016 11:15:59 +0200 Message-ID: To: Marcin Kerlin Cc: "dev@dpdk.org" , Sergio Gonzalez Monroy Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH 1/1] lib/librte_eal: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 09:16:19 -0000 On Tue, Apr 19, 2016 at 6:27 PM, Marcin Kerlin wrote: > Fix issue reported by Coverity. > > Coverity ID 13295, 13296, 13303: > Resource leak: The system resource will not be reclaimed > and reused, reducing the future availability of the resource. > In rte_eal_hugepage_attach: Leak of memory or pointers to system > resources. > > Fixes: af75078fece3 ("first public release") > > Signed-off-by: Marcin Kerlin > --- > lib/librte_eal/linuxapp/eal/eal_memory.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c > index 5b9132c..6320aa0 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -1475,13 +1475,17 @@ rte_eal_hugepage_attach(void) > "and retry running both primary " > "and secondary processes\n"); > } > + > + if (base_addr != MAP_FAILED) > + munmap((void *)(uintptr_t)base_addr, mcfg->memseg[s].len); > + What is the point of this casting ? Idem for the rest of the patch. I can't see cleanup for previously mapped segments when mapping one fails. Do we want this cleanup as well ? CC Sergio. -- David Marchand