[v2,02/10] eventdev: fix possible use of uninitialized var

Message ID 20190917075754.8310-3-amo@semihalf.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Add an option to use LTO for DPDK build |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Andrzej Ostruszka Sept. 17, 2019, 7:57 a.m. UTC
  Fix the logic for the case of event queue allowing all schedule types.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
---
 lib/librte_eventdev/rte_event_timer_adapter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Jerin Jacob Oct. 12, 2019, 1:35 p.m. UTC | #1
On Tue, Sep 17, 2019 at 1:28 PM Andrzej Ostruszka <amo@semihalf.com> wrote:
>
> Fix the logic for the case of event queue allowing all schedule types.
>
> Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>

This fix looks good to me.

# Please fix check-git-log.sh errors.
Missing 'Fixes' tag:
        eventdev: fix possible use of uninitialized var

# If it is reported by LTO, please add the compiler warning output in
git commit.

With the above fix:
Reviewed-by: Jerin Jacob <jerinj@marvell.com>

> ---
>  lib/librte_eventdev/rte_event_timer_adapter.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c
> index 5ce399eca..161e21a68 100644
> --- a/lib/librte_eventdev/rte_event_timer_adapter.c
> +++ b/lib/librte_eventdev/rte_event_timer_adapter.c
> @@ -706,11 +706,11 @@ check_destination_event_queue(struct rte_event_timer *evtim,
>                                        RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE,
>                                        &sched_type);
>
> -       if ((ret < 0 && ret != -EOVERFLOW) ||
> -           evtim->ev.sched_type != sched_type)
> -               return -1;
> +       if ((ret == 0 && evtim->ev.sched_type == sched_type) ||
> +           ret == -EOVERFLOW)
> +               return 0;
>
> -       return 0;
> +       return -1;
>  }
>
>  static int
> --
> 2.17.1
>
  

Patch

diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c
index 5ce399eca..161e21a68 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.c
+++ b/lib/librte_eventdev/rte_event_timer_adapter.c
@@ -706,11 +706,11 @@  check_destination_event_queue(struct rte_event_timer *evtim,
 				       RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE,
 				       &sched_type);
 
-	if ((ret < 0 && ret != -EOVERFLOW) ||
-	    evtim->ev.sched_type != sched_type)
-		return -1;
+	if ((ret == 0 && evtim->ev.sched_type == sched_type) ||
+	    ret == -EOVERFLOW)
+		return 0;
 
-	return 0;
+	return -1;
 }
 
 static int