From: Haiyang Tan <haiyangtan@tencent.com>
To: Beilei Xing <beilei.xing@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Cc: dev@dpdk.org, Haiyang Tan <haiyangtan@tencent.com>
Subject: [dpdk-dev] [PATCH] net/i40e: fix possible uninitialized variable
Date: Sat, 22 Dec 2018 04:27:44 -0800 [thread overview]
Message-ID: <20181222122745.823-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/i40e/i40e_ethdev.c | 45 ++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 8dc1a4af8..7ed3ad0a9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -954,17 +954,16 @@ i40e_init_ethtype_filter_list(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_ethertype_rule *ethertype_rule = &pf->ethertype;
+ struct rte_hash_parameters ethertype_hash_params = { 0 };
char ethertype_hash_name[RTE_HASH_NAMESIZE];
int ret;
- struct rte_hash_parameters ethertype_hash_params = {
- .name = ethertype_hash_name,
- .entries = I40E_MAX_ETHERTYPE_FILTER_NUM,
- .key_len = sizeof(struct i40e_ethertype_filter_input),
- .hash_func = rte_hash_crc,
- .hash_func_init_val = 0,
- .socket_id = rte_socket_id(),
- };
+ ethertype_hash_params.name = ethertype_hash_name;
+ ethertype_hash_params.entries = I40E_MAX_ETHERTYPE_FILTER_NUM;
+ ethertype_hash_params.key_len = sizeof(struct i40e_ethertype_filter_input);
+ ethertype_hash_params.hash_func = rte_hash_crc;
+ ethertype_hash_params.hash_func_init_val = 0;
+ ethertype_hash_params.socket_id = rte_socket_id();
/* Initialize ethertype filter rule list and hash */
TAILQ_INIT(ðertype_rule->ethertype_list);
@@ -999,17 +998,16 @@ i40e_init_tunnel_filter_list(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_tunnel_rule *tunnel_rule = &pf->tunnel;
+ struct rte_hash_parameters tunnel_hash_params = { 0 };
char tunnel_hash_name[RTE_HASH_NAMESIZE];
int ret;
- struct rte_hash_parameters tunnel_hash_params = {
- .name = tunnel_hash_name,
- .entries = I40E_MAX_TUNNEL_FILTER_NUM,
- .key_len = sizeof(struct i40e_tunnel_filter_input),
- .hash_func = rte_hash_crc,
- .hash_func_init_val = 0,
- .socket_id = rte_socket_id(),
- };
+ tunnel_hash_params.name = tunnel_hash_name;
+ tunnel_hash_params.entries = I40E_MAX_TUNNEL_FILTER_NUM;
+ tunnel_hash_params.key_len = sizeof(struct i40e_tunnel_filter_input);
+ tunnel_hash_params.hash_func = rte_hash_crc;
+ tunnel_hash_params.hash_func_init_val = 0;
+ tunnel_hash_params.socket_id = rte_socket_id();
/* Initialize tunnel filter rule list and hash */
TAILQ_INIT(&tunnel_rule->tunnel_list);
@@ -1044,17 +1042,16 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_fdir_info *fdir_info = &pf->fdir;
+ struct rte_hash_parameters fdir_hash_params = { 0 };
char fdir_hash_name[RTE_HASH_NAMESIZE];
int ret;
- struct rte_hash_parameters fdir_hash_params = {
- .name = fdir_hash_name,
- .entries = I40E_MAX_FDIR_FILTER_NUM,
- .key_len = sizeof(struct i40e_fdir_input),
- .hash_func = rte_hash_crc,
- .hash_func_init_val = 0,
- .socket_id = rte_socket_id(),
- };
+ fdir_hash_params.name = fdir_hash_name;
+ fdir_hash_params.entries = I40E_MAX_FDIR_FILTER_NUM;
+ fdir_hash_params.key_len = sizeof(struct i40e_fdir_input);
+ fdir_hash_params.hash_func = rte_hash_crc;
+ fdir_hash_params.hash_func_init_val = 0;
+ fdir_hash_params.socket_id = rte_socket_id();
/* Initialize flow director filter rule list and hash */
TAILQ_INIT(&fdir_info->fdir_list);
--
2.14.1
reply other threads:[~2018-12-22 12:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20181222122745.823-1-haiyangtan@tencent.com \
--to=haiyangtan@tencent.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@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).