From: Kuba Kozak <kubax.kozak@intel.com>
To: dev@dpdk.org
Cc: harry.van.haaren@intel.com, deepak.k.jain@intel.com,
michalx.k.jastrzebski@intel.com, kubax.kozak@intel.com
Subject: [dpdk-dev] [PATCH] ethdev: fix wrong sizeof argument in malloc function
Date: Tue, 9 May 2017 07:22:13 +0200 [thread overview]
Message-ID: <1494307334-19960-1-git-send-email-kubax.kozak@intel.com> (raw)
From: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Coverity reported that an argument for sizeof was used improperly.
We should allocate memory for value size that pointer points to,
instead of pointer size itself.
Coverity issue: 144522
Fixes: 79c913a42f0e ("ethdev: retrieve xstats by ID")
Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
---
lib/librte_ether/rte_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8cf8b65..83898a8 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1714,7 +1714,7 @@ struct rte_eth_dev *
size = rte_eth_xstats_get_by_id(port_id, NULL, NULL, 0);
- values_copy = malloc(sizeof(values_copy) * size);
+ values_copy = malloc(sizeof(*values_copy) * size);
if (!values_copy) {
RTE_PMD_DEBUG_TRACE(
"ERROR: can't allocate memory for values_copy\n");
--
1.7.9.5
next reply other threads:[~2017-05-09 5:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 5:22 Kuba Kozak [this message]
2017-05-09 8:46 ` Van Haaren, Harry
2017-05-10 14:52 ` 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=1494307334-19960-1-git-send-email-kubax.kozak@intel.com \
--to=kubax.kozak@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=michalx.k.jastrzebski@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).