stack: fix possible uninitialized success variable
diff mbox series

Message ID 389c3874a5bc2db3056b222ec48c860b96f7ad67.1601009974.git.wangyunjian@huawei.com
State Accepted
Delegated to: David Marchand
Headers show
Series
  • stack: fix possible uninitialized success variable
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

wangyunjian Sept. 25, 2020, 5 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

This patch fixes an issue that uninitialized 'success'
is used to be compared with '0'.

Coverity issue: 337676
Fixes: 3340202f5954 ("stack: add lock-free implementation")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 lib/librte_stack/rte_stack_lf_generic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Marchand Sept. 28, 2020, 10:29 a.m. UTC | #1
On Fri, Sep 25, 2020 at 7:02 AM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> This patch fixes an issue that uninitialized 'success'
> is used to be compared with '0'.
>
> Coverity issue: 337676
> Fixes: 3340202f5954 ("stack: add lock-free implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  lib/librte_stack/rte_stack_lf_generic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_stack/rte_stack_lf_generic.h b/lib/librte_stack/rte_stack_lf_generic.h
> index 3abbb5342..4850a05ee 100644
> --- a/lib/librte_stack/rte_stack_lf_generic.h
> +++ b/lib/librte_stack/rte_stack_lf_generic.h
> @@ -78,7 +78,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
>                          struct rte_stack_lf_elem **last)
>  {
>         struct rte_stack_lf_head old_head;
> -       int success;
> +       int success = 0;
>
>         /* Reserve num elements, if available */
>         while (1) {
> --
> 2.23.0
>

Reviewed-by: David Marchand <david.marchand@redhat.com>
David Marchand Sept. 30, 2020, 7:15 p.m. UTC | #2
On Mon, Sep 28, 2020 at 12:29 PM David Marchand
<david.marchand@redhat.com> wrote:
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > This patch fixes an issue that uninitialized 'success'
> > is used to be compared with '0'.
> >
> > Coverity issue: 337676
> > Fixes: 3340202f5954 ("stack: add lock-free implementation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.

Patch
diff mbox series

diff --git a/lib/librte_stack/rte_stack_lf_generic.h b/lib/librte_stack/rte_stack_lf_generic.h
index 3abbb5342..4850a05ee 100644
--- a/lib/librte_stack/rte_stack_lf_generic.h
+++ b/lib/librte_stack/rte_stack_lf_generic.h
@@ -78,7 +78,7 @@  __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 			 struct rte_stack_lf_elem **last)
 {
 	struct rte_stack_lf_head old_head;
-	int success;
+	int success = 0;
 
 	/* Reserve num elements, if available */
 	while (1) {