All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Gage Eads <gage.eads@intel.com>
Cc: dev@dpdk.org, Andre Muezerie <andremue@linux.microsoft.com>,
	stable@dpdk.org
Subject: [PATCH] stack: occasional crash due to uninitialized variable
Date: Mon,  3 Feb 2025 17:23:37 -0800	[thread overview]
Message-ID: <1738632218-5796-1-git-send-email-andremue@linux.microsoft.com> (raw)

Variable "success" was not being initialized and there was a code
path where the last do/while loop in __rte_stack_lf_pop_elems
looked at the value of this variable before it was set to any.

Compiling with msvc resulted in stack_lf_autotest sometimes crashing.

The fix is to initialize the variable. This same fix was applied to
stack\rte_stack_lf_generic.h in the past but was missed here.

Fixes: 7e6e609939a8 ("stack: add C11 atomic implementation")
Cc: stable@dpdk.org

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 lib/stack/rte_stack_lf_c11.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h
index 60d46e963b..ee1c79c095 100644
--- a/lib/stack/rte_stack_lf_c11.h
+++ b/lib/stack/rte_stack_lf_c11.h
@@ -77,7 +77,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 {
 	struct rte_stack_lf_head old_head;
 	uint64_t len;
-	int success;
+	int success = 0;
 
 	/* Reserve num elements, if available */
 	len = rte_atomic_load_explicit(&list->len, rte_memory_order_relaxed);
-- 
2.47.2.vfs.0.1


             reply	other threads:[~2025-02-04  1:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04  1:23 Andre Muezerie [this message]
2025-02-04 12:45 ` [PATCH] stack: occasional crash due to uninitialized variable David Marchand
2025-03-06 13:19 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1738632218-5796-1-git-send-email-andremue@linux.microsoft.com \
    --to=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.