patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Hyong Youb Kim <hyonkim@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>,
	stable@dpdk.org, John Daley <johndale@cisco.com>
Subject: [dpdk-stable] [PATCH] net/enic: fix header sizes when copying flow patterns
Date: Fri, 30 Oct 2020 00:27:49 -0700	[thread overview]
Message-ID: <20201030072749.29113-1-hyonkim@cisco.com> (raw)

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: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_fm_flow.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 9cea94269c..86b91ed8b1 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -368,8 +368,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;
 }
 
@@ -479,8 +479,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;
 }
 
@@ -1047,7 +1047,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 */
-- 
2.26.2


             reply	other threads:[~2020-10-30  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  7:27 Hyong Youb Kim [this message]
2020-10-30 17:53 ` 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=20201030072749.29113-1-hyonkim@cisco.com \
    --to=hyonkim@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=johndale@cisco.com \
    --cc=stable@dpdk.org \
    /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).