Skip to content

Commit

Permalink
net/enic: fix header sizes when copying flow patterns
Browse files Browse the repository at this point in the history
[ upstream commit dd64991 ]

Several functions use sizeof(struct rte_flow_item_eth) and
sizeof(struct rte_flow_item_ipv6) when copying headers. These sizes
used to coincide with the sizes of rte_ether_hdr and
rte_ipv6_hdr. But, with recently added fields, rte_flow_item_eth and
rte_flow_item_ipv6 have grown in size. Use sizeof(rte_ether_hdr) and
sizeof(rte_ipv6_hdr) instead.

Coverity issue: 363572, 363573
Fixes: ea7768b ("net/enic: add flow implementation based on Flow Manager API")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
  • Loading branch information
Hyong Youb Kim authored and bluca committed Nov 9, 2020
1 parent 8ce5fa4 commit 87cb957
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/net/enic/enic_fm_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ enic_fm_copy_item_eth(struct copy_item_args *arg)
fm_mask = &entry->ftm_mask.fk_hdrset[lvl];
fm_data->fk_header_select |= FKH_ETHER;
fm_mask->fk_header_select |= FKH_ETHER;
memcpy(&fm_data->l2.eth, spec, sizeof(*spec));
memcpy(&fm_mask->l2.eth, mask, sizeof(*mask));
memcpy(&fm_data->l2.eth, spec, sizeof(struct rte_ether_hdr));
memcpy(&fm_mask->l2.eth, mask, sizeof(struct rte_ether_hdr));
return 0;
}

Expand Down Expand Up @@ -423,8 +423,8 @@ enic_fm_copy_item_ipv6(struct copy_item_args *arg)

fm_data->fk_header_select |= FKH_IPV6;
fm_mask->fk_header_select |= FKH_IPV6;
memcpy(&fm_data->l3.ip6, spec, sizeof(*spec));
memcpy(&fm_mask->l3.ip6, mask, sizeof(*mask));
memcpy(&fm_data->l3.ip6, spec, sizeof(struct rte_ipv6_hdr));
memcpy(&fm_mask->l3.ip6, mask, sizeof(struct rte_ipv6_hdr));
return 0;
}

Expand Down Expand Up @@ -970,7 +970,7 @@ enic_fm_copy_vxlan_encap(struct enic_flowman *fm,
eth = (struct rte_ether_hdr *)template;
ethertype = &eth->ether_type;
append_template(&template, &off, item->spec,
sizeof(struct rte_flow_item_eth));
sizeof(struct rte_ether_hdr));
item++;
flow_item_skip_void(&item);
/* Optional VLAN */
Expand Down

0 comments on commit 87cb957

Please sign in to comment.