From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
To: john.mcnamara@intel.com
Cc: marko.kovacevic@intel.com, dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] timer: fix pointer to local outside scope
Date: Wed, 24 Apr 2019 09:33:50 -0500 [thread overview]
Message-ID: <1556116430-22593-1-git-send-email-erik.g.carrillo@intel.com> (raw)
Message-ID: <20190424143350.zwzbxxJ9mZ95UuA7xWTP-CP5y6iz7yOT_c7oILCjrxY@z> (raw)
A null array is allowed to be passed as one of the parameters to
rte_timer_alt_manage() as a convenience. When that happened, an
anonymous array was created using compound literal syntax, and Coverity
detected that the object was out of scope in later uses of it. Create
an object in the proper scope instead.
Coverity issue: 337919
Fixes: c0749f7096c7 ("timer: allow management in shared memory")
Cc: stable@dpdk.org
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
lib/librte_timer/rte_timer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index eb46009..d443b8c 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -826,6 +826,7 @@ rte_timer_alt_manage(uint32_t timer_data_id,
int nb_poll_lcores,
rte_timer_alt_manage_cb_t f)
{
+ unsigned int default_poll_lcores[] = {rte_lcore_id()};
union rte_timer_status status;
struct rte_timer *tim, *next_tim, **pprev;
struct rte_timer *run_first_tims[RTE_MAX_LCORE];
@@ -847,8 +848,8 @@ rte_timer_alt_manage(uint32_t timer_data_id,
__TIMER_STAT_ADD(data->priv_timer, manage, 1);
if (poll_lcores == NULL) {
- poll_lcores = (unsigned int []){rte_lcore_id()};
- nb_poll_lcores = 1;
+ poll_lcores = default_poll_lcores;
+ nb_poll_lcores = RTE_DIM(default_poll_lcores);
}
for (i = 0; i < nb_poll_lcores; i++) {
--
2.6.4
next reply other threads:[~2019-04-24 14:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 14:33 Erik Gabriel Carrillo [this message]
2019-04-24 14:33 ` Erik Gabriel Carrillo
2019-05-03 20:57 ` Thomas Monjalon
2019-05-03 20:57 ` 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=1556116430-22593-1-git-send-email-erik.g.carrillo@intel.com \
--to=erik.g.carrillo@intel.com \
--cc=dev@dpdk.org \
--cc=john.mcnamara@intel.com \
--cc=marko.kovacevic@intel.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 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).