From: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Subject: [dpdk-dev] [PATCH v1 1/1] examples/bond: fix unchecked return value
Date: Wed, 29 Jun 2016 15:15:38 +0200 [thread overview]
Message-ID: <1467206138-153175-1-git-send-email-piotrx.t.azarewicz@intel.com> (raw)
The example is calling rte_eal_wait_lcore without checking return value.
Now it is fixed by checking the value and print proper message.
Coverity issue: 37789
Coverity issue: 37790
Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")
Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
---
examples/bond/main.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 53bd044..776fad0 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -590,10 +590,14 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
return;
}
global_flag_stru_p->LcoreMainIsRunning = 0;
- rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
- cmdline_printf(cl,
- "lcore_main stopped on core:%d\n",
- global_flag_stru_p->LcoreMainCore);
+ if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+ cmdline_printf(cl,
+ "error: lcore_main can not stop on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
+ else
+ cmdline_printf(cl,
+ "lcore_main stopped on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
rte_spinlock_unlock(&global_flag_stru_p->lock);
}
@@ -628,10 +632,14 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
return;
}
global_flag_stru_p->LcoreMainIsRunning = 0;
- rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
- cmdline_printf(cl,
- "lcore_main stopped on core:%d\n",
- global_flag_stru_p->LcoreMainCore);
+ if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+ cmdline_printf(cl,
+ "error: lcore_main can not stop on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
+ else
+ cmdline_printf(cl,
+ "lcore_main stopped on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
rte_spinlock_unlock(&global_flag_stru_p->lock);
cmdline_quit(cl);
}
--
1.7.9.5
next reply other threads:[~2016-06-29 12:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-29 13:15 Piotr Azarewicz [this message]
2016-06-30 10:46 ` Azarewicz, PiotrX T
[not found] <1467192217-182940-1-git-send-email-piotrx.t.azarewicz@intel.com>
2016-06-30 9:13 ` Declan Doherty
2016-07-11 14:21 ` Thomas Monjalon
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=1467206138-153175-1-git-send-email-piotrx.t.azarewicz@intel.com \
--to=piotrx.t.azarewicz@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).