]> git.droids-corp.org - dpdk.git/commitdiff
mem: fix resize return handling for --single-file-segments
authorJianfeng Tan <jianfeng.tan@intel.com>
Thu, 26 Apr 2018 08:06:53 +0000 (08:06 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:42:40 +0000 (23:42 +0200)
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")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c

index 1f553dd2a6c7c81ac0bb81005600ac0c944d3e48..301c34ee7bb13b1ab4f1587ec8a5bdb2acdf2808 100644 (file)
@@ -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;