From patchwork Sat May 12 01:48:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 39883 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3728E1CC30; Sat, 12 May 2018 03:48:30 +0200 (CEST) Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 44C871CC25 for ; Sat, 12 May 2018 03:48:28 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Sat, 12 May 2018 09:48:24 +0800 Message-ID: <152608970447.121204.3662840668412795807.stgit@localhost.localdomain> In-Reply-To: <152608956198.121204.14844325841690943774.stgit@localhost.localdomain> References: <152608956198.121204.14844325841690943774.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Subject: [dpdk-dev] [PATCH v5 08/16] net/nfp: don't memcpy out of source range X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" /home/agreen/projects/dpdk/drivers/net/nfp/nfp_net.c:669:2: error: ‘memcpy’ forming offset [5, 6] is out of the bounds [0, 4] of object ‘tmp’ with type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=array-bounds] memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr)); Signed-off-by: Andy Green Acked-by: Alejandro Lucero Tested-by: Alejandro Lucero Fixes: e6decee38209 ("net/nfp: use random MAC address if not configured") Cc: stable@dpdk.org --- drivers/net/nfp/nfp_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 78113b41b..f114b1839 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -666,7 +666,7 @@ nfp_net_vf_read_mac(struct nfp_net_hw *hw) uint32_t tmp; tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR)); - memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr)); + memcpy(&hw->mac_addr[0], &tmp, 4); tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4)); memcpy(&hw->mac_addr[4], &tmp, 2);