@@ -911,6 +911,9 @@ static int nthw_setup_managed_virt_queue_packed(struct nthw_virt_queue *vq,
RTE_ASSERT(p_packet_buffers);
/* clean canvas */
+ if (p_virt_struct_area->virt_addr == NULL)
+ return -1;
+
memset(p_virt_struct_area->virt_addr, 0,
sizeof(struct pvirtq_desc) * vq->queue_size +
sizeof(struct pvirtq_event_suppress) * 2 + sizeof(int) * vq->queue_size);
@@ -137,6 +137,8 @@ static int _link_state_build(adapter_info_t *drv, nthw_mac_pcs_t *mac_pcs,
uint32_t lh_internal_local_fault;
uint32_t lh_received_local_fault;
+ RTE_ASSERT(state);
+
memset(state, 0, sizeof(*state));
state->link_disabled = is_port_disabled;
nthw_mac_pcs_get_link_summary(mac_pcs, &abs, &phy_link_state, &lh_abs, &ll_phy_link_state,
@@ -114,7 +114,8 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)
struct ntnic_id_table_element *current_element =
ntnic_id_table_array_find_element(handle, id);
- memset(current_element, 0, sizeof(struct ntnic_id_table_element));
+ if (current_element)
+ memset(current_element, 0, sizeof(struct ntnic_id_table_element));
struct ntnic_id_table_element *element =
ntnic_id_table_array_find_element(handle, handle->free_head);
@@ -86,7 +86,8 @@ void *nthw_callocate_mod(struct common_func_s *mod, int sets, ...)
void nthw_zero_module_cache(struct common_func_s *mod)
{
- memset(mod->base, 0, mod->allocated_size);
+ if (mod)
+ memset(mod->base, 0, mod->allocated_size);
}
int nthw_flow_api_backend_init(struct flow_api_backend_s *dev,
@@ -1714,15 +1714,14 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,
*in_port_id = UINT32_MAX;
- memset(packet_data, 0x0, sizeof(uint32_t) * 10);
- memset(packet_mask, 0x0, sizeof(uint32_t) * 10);
- memset(key_def, 0x0, sizeof(struct flm_flow_key_def_s));
-
- if (elem == NULL) {
+ if (packet_data == NULL || packet_mask == NULL || key_def == NULL || elem == NULL) {
nthw_flow_nic_set_error(ERR_FAILED, error);
NT_LOG(ERR, FILTER, "Flow items missing");
return -1;
}
+ memset(packet_data, 0x0, sizeof(uint32_t) * 10);
+ memset(packet_mask, 0x0, sizeof(uint32_t) * 10);
+ memset(key_def, 0x0, sizeof(struct flm_flow_key_def_s));
if (implicit_vlan_vid > 0) {
uint32_t *sw_data = &packet_data[1 - sw_counter];
@@ -3192,6 +3191,9 @@ static int convert_fh_to_fh_flm(struct flow_handle *fh, const uint32_t *packet_d
static void setup_db_qsl_data(struct nic_flow_def *fd, struct hw_db_inline_qsl_data *qsl_data,
uint32_t num_dest_port, uint32_t num_queues)
{
+ if (qsl_data == NULL)
+ return;
+
memset(qsl_data, 0x0, sizeof(struct hw_db_inline_qsl_data));
if (fd->dst_num_avail <= 0) {
@@ -3236,6 +3238,9 @@ static void setup_db_qsl_data(struct nic_flow_def *fd, struct hw_db_inline_qsl_d
static void setup_db_hsh_data(struct nic_flow_def *fd, struct hw_db_inline_hsh_data *hsh_data)
{
+ if (hsh_data == NULL)
+ return;
+
memset(hsh_data, 0x0, sizeof(struct hw_db_inline_hsh_data));
hsh_data->func = fd->hsh.func;
@@ -4816,7 +4821,8 @@ int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id,
int res = 0;
nthw_flow_nic_set_error(ERR_SUCCESS, error);
- memset(port_info, 0, sizeof(struct rte_flow_port_info));
+ if (port_info)
+ memset(port_info, 0, sizeof(struct rte_flow_port_info));
port_info->max_nb_aging_objects = dev->nb_aging_objects;
@@ -854,8 +854,10 @@ void nthw_register_flush(const nthw_register_t *p, uint32_t cnt)
void nthw_register_clr(nthw_register_t *p)
{
- memset(p->mp_shadow, 0, p->mn_len * sizeof(uint32_t));
- nthw_register_make_dirty(p);
+ if (p->mp_shadow) {
+ memset(p->mp_shadow, 0, p->mn_len * sizeof(uint32_t));
+ nthw_register_make_dirty(p);
+ }
}
/*
@@ -51,6 +51,9 @@ static int eth_mtr_capabilities_get_inline(struct rte_eth_dev *eth_dev,
"Ethernet device does not support metering");
}
+ if (cap == NULL)
+ return -1;
+
memset(cap, 0x0, sizeof(struct rte_mtr_capabilities));
/* MBR records use 28-bit integers */
@@ -419,6 +422,9 @@ static int eth_mtr_stats_read_inline(struct rte_eth_dev *eth_dev,
"MTR id is out of range");
}
+ if (stats == NULL)
+ return -1;
+
memset(stats, 0x0, sizeof(struct rte_mtr_stats));
profile_inline_ops->flm_mtr_read_stats(internals->flw_dev, caller_id, mtr_id, stats_mask,
&stats->n_pkts[RTE_COLOR_GREEN],
@@ -248,6 +248,11 @@ int nthw_interpret_raw_data(uint8_t *data, uint8_t *preserve, int size, struct r
int nthw_create_attr(struct cnv_attr_s *attribute, const struct rte_flow_attr *attr)
{
+ if (!attribute) {
+ NT_LOG(ERR, FILTER, "ERROR no attribute to iterate!");
+ return -1;
+ }
+
memset(&attribute->attr, 0x0, sizeof(struct rte_flow_attr));
if (attr) {