net/i40e: fix possible uninitialized variable
Checks
Commit Message
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(-)
@@ -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);