From: Anatoly Burakov Date: Tue, 17 Jul 2018 15:41:45 +0000 (+0100) Subject: mem: add logic check for static analyzer X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dd536a8bc5bb1f2b7e530272c9a2d2c15c7fdb32;p=dpdk.git mem: add logic check for static analyzer Technically, single file segments codepath will never get triggered when using in-memory mode, because EAL prohibits mixing these two options at initialization time. However, code analyzers do not know that, and some will complain about either using uninitialized variables, or trying to do operations on an already closed descriptor. Fix this by assuring the compiler or code analyzer that in-memory mode code never gets triggered when using single-file segments mode. Coverity issue: 302847 Fixes: 72b49ff623c4 ("mem: support --in-memory mode") Signed-off-by: Anatoly Burakov --- diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 79443c56a8..a59f229cd4 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -481,7 +481,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, void *new_addr; alloc_sz = hi->hugepage_sz; - if (internal_config.in_memory && anonymous_hugepages_supported) { + if (!internal_config.single_file_segments && + internal_config.in_memory && + anonymous_hugepages_supported) { int log2, flags; log2 = rte_log2_u32(alloc_sz);