From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-dev] [PATCH v1] lib/metrics: disallow NULL as metric name
Date: Mon, 2 Jul 2018 14:46:08 +0100 [thread overview]
Message-ID: <20180702134608.6805-1-remy.horton@intel.com> (raw)
This patch adds a sanity check so that names passed into
rte_metrics_reg_names() and the wrapper rte_metrics_reg_name()
cannot be NULL.
Fixes: 349950ddb9c5 ("metrics: add information metrics library")
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
lib/librte_metrics/rte_metrics.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/librte_metrics/rte_metrics.c b/lib/librte_metrics/rte_metrics.c
index 258f058..2275244 100644
--- a/lib/librte_metrics/rte_metrics.c
+++ b/lib/librte_metrics/rte_metrics.c
@@ -96,6 +96,9 @@ rte_metrics_reg_names(const char * const *names, uint16_t cnt_names)
/* Some sanity checks */
if (cnt_names < 1 || names == NULL)
return -EINVAL;
+ for (idx_name = 0; idx_name < cnt_names; idx_name++)
+ if (names[idx_name] == NULL)
+ return -EINVAL;
memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
if (memzone == NULL)
--
2.9.5
next reply other threads:[~2018-07-02 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 13:46 Remy Horton [this message]
2018-07-20 15:30 ` Ferruh Yigit
2018-07-26 18:31 ` 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=20180702134608.6805-1-remy.horton@intel.com \
--to=remy.horton@intel.com \
--cc=dev@dpdk.org \
--cc=reshma.pattan@intel.com \
/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).