From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jianfeng Tan Subject: [PATCH] mem: fix handling return value Date: Thu, 26 Apr 2018 08:06:53 +0000 Message-ID: <1524730013-61990-1-git-send-email-jianfeng.tan@intel.com> Cc: Jianfeng Tan , Anatoly Burakov To: dev@dpdk.org Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 365796CA3 for ; Thu, 26 Apr 2018 10:04:47 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" resize_hugefile() returns either 0 (which indicates success) or -1 (which indicates failure). We failed to check the success as we use --single-file-segments option. Fixes: 2a04139f66b4 ("eal: add single file segments option") Cc: Anatoly Burakov Signed-off-by: Jianfeng Tan --- lib/librte_eal/linuxapp/eal/eal_memalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 1f553dd..301c34e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -419,7 +419,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, if (internal_config.single_file_segments) { map_offset = seg_idx * alloc_sz; ret = resize_hugefile(fd, map_offset, alloc_sz, true); - if (ret < 1) + if (ret < 0) goto resized; } else { map_offset = 0; -- 2.7.4