From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 2DACD1B53 for ; Tue, 29 Aug 2017 10:31:40 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2017 01:31:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,444,1498546800"; d="scan'208";a="1211853381" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.28]) ([10.237.221.28]) by fmsmga002.fm.intel.com with ESMTP; 29 Aug 2017 01:31:38 -0700 To: Seth Howell , dev@dpdk.org References: <20170815205336.9266-1-seth.howell@intel.com> <20170828214912.133503-1-seth.howell@intel.com> From: Sergio Gonzalez Monroy Message-ID: <87709ac9-19a0-497b-f5c2-fbfcef1cc773@intel.com> Date: Tue, 29 Aug 2017 09:31:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20170828214912.133503-1-seth.howell@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3] eal/linuxapp: check mmap return value MAP_FAILED 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, 29 Aug 2017 08:31:40 -0000 On 28/08/2017 22:49, Seth Howell wrote: > If mmap fails, it will return the value MAP_FAILED. Checking for this > return code allows us to properly identify mmap failures and report > them as such to the calling function. > > Signed-off-by: Seth Howell > --- > lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c > index 5279128..63fec29 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -716,6 +716,8 @@ create_shared_memory(const char *filename, const size_t mem_size) > } > retval = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); > close(fd); > + if (retval == MAP_FAILED) > + return NULL; > return retval; > } > Acked-by: Sergio Gonzalez Monroy