From: Haiyang Tan <haiyangtan@tencent.com>
To: John Daley <johndale@cisco.com>, Hyong Youb Kim <hyonkim@cisco.com>
Cc: dev@dpdk.org, Haiyang Tan <haiyangtan@tencent.com>
Subject: [dpdk-dev] [PATCH] net/enic: fix possible uninitialized variable
Date: Sat, 22 Dec 2018 04:41:03 -0800 [thread overview]
Message-ID: <20181222124103.116759-1-haiyangtan@tencent.com> (raw)
The uninitialized field 'extra_flag' of hash parameter may enable
certain feature silently. Typically, if bit0 of 'extra_flag' set, the
hardware transactional memory support will be enabled unexpectedly.
Signed-off-by: Haiyang Tan <haiyangtan@tencent.com>
---
drivers/net/enic/enic_clsf.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c
index 9d95201ec..f9707c78f 100644
--- a/drivers/net/enic/enic_clsf.c
+++ b/drivers/net/enic/enic_clsf.c
@@ -475,14 +475,15 @@ void enic_clsf_destroy(struct enic *enic)
int enic_clsf_init(struct enic *enic)
{
char clsf_name[RTE_HASH_NAMESIZE];
- struct rte_hash_parameters hash_params = {
- .name = clsf_name,
- .entries = ENICPMD_CLSF_HASH_ENTRIES,
- .key_len = sizeof(struct rte_eth_fdir_filter),
- .hash_func = DEFAULT_HASH_FUNC,
- .hash_func_init_val = 0,
- .socket_id = SOCKET_ID_ANY,
- };
+ struct rte_hash_parameters hash_params = { 0 };
+
+ hash_params.name = clsf_name;
+ hash_params.entries = ENICPMD_CLSF_HASH_ENTRIES;
+ hash_params.key_len = sizeof(struct rte_eth_fdir_filter);
+ hash_params.hash_func = DEFAULT_HASH_FUNC;
+ hash_params.hash_func_init_val = 0;
+ hash_params.socket_id = SOCKET_ID_ANY;
+
snprintf(clsf_name, RTE_HASH_NAMESIZE, "enic_clsf_%s", enic->bdf_name);
enic->fdir.hash = rte_hash_create(&hash_params);
memset(&enic->fdir.stats, 0, sizeof(enic->fdir.stats));
--
2.14.1
next reply other threads:[~2018-12-22 12:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-22 12:41 Haiyang Tan [this message]
2019-01-02 18:02 ` Ferruh Yigit
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=20181222124103.116759-1-haiyangtan@tencent.com \
--to=haiyangtan@tencent.com \
--cc=dev@dpdk.org \
--cc=hyonkim@cisco.com \
--cc=johndale@cisco.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).