All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mem: fix static analysis warning
@ 2018-07-17 15:41 Anatoly Burakov
  2018-07-20  9:30 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Burakov @ 2018-07-17 15:41 UTC (permalink / raw)
  To: dev

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 ID: 302847
Fixes: 72b49ff623c4 ("mem: support --in-memory mode")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memalloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
index 79443c56a..a59f229cd 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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mem: fix static analysis warning
  2018-07-17 15:41 [PATCH] mem: fix static analysis warning Anatoly Burakov
@ 2018-07-20  9:30 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2018-07-20  9:30 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev

17/07/2018 17:41, Anatoly Burakov:
> 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 ID: 302847
> Fixes: 72b49ff623c4 ("mem: support --in-memory mode")
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-20  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 15:41 [PATCH] mem: fix static analysis warning Anatoly Burakov
2018-07-20  9:30 ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.