From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4DC5BA0562; Wed, 1 Apr 2020 05:34:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C1981BED3; Wed, 1 Apr 2020 05:34:22 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 334D61BE9A; Wed, 1 Apr 2020 05:34:20 +0200 (CEST) IronPort-SDR: S33SoYlDdgD3VvCkhsuducqzqUkMF8nIVFHxD7eho+7eg1hZHGfVA47gE1urIg9MoHUc28PPZ6 IrXKkTljjzUg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 20:34:20 -0700 IronPort-SDR: zFZ7KoWC3N34uX65l8QsgDnXxYX5St7Bcridb9apQ5QM3e2pimhfslEFhM6f4H19bX8StmyjKj ixFCULEgiRSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,330,1580803200"; d="scan'208";a="450389623" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga006.fm.intel.com with ESMTP; 31 Mar 2020 20:34:18 -0700 Date: Wed, 1 Apr 2020 11:30:52 +0800 From: Ye Xiaolong To: Haiyue Wang Cc: dev@dpdk.org, qi.z.zhang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com, stable@dpdk.org Message-ID: <20200401033052.GK29805@intel.com> References: <20200331065034.4853-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331065034.4853-1-haiyue.wang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v1] net/ice/base: check memory pointer before copying 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" On 03/31, Haiyue Wang wrote: >The ice_memdup doesn't check the new allocated memory pointer, it calls >the rte_memcpy directly. It should check it. > >Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation") >Cc: stable@dpdk.org > >Signed-off-by: Haiyue Wang >--- > drivers/net/ice/base/ice_osdep.h | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h >index a4a2994c7..88c2a65be 100644 >--- a/drivers/net/ice/base/ice_osdep.h >+++ b/drivers/net/ice/base/ice_osdep.h >@@ -24,6 +24,8 @@ > #include > #include > >+#include "ice_alloc.h" >+ > #include "../ice_logs.h" > > #ifndef __INTEL_NET_BASE_OSDEP__ >@@ -193,7 +195,6 @@ struct ice_virt_mem { > > #define ice_memset(a, b, c, d) memset((a), (b), (c)) > #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c)) >-#define ice_memdup(a, b, c, d) rte_memcpy(ice_malloc(a, c), b, c) > > /* SW spinlock */ > struct ice_lock { >@@ -225,6 +226,19 @@ ice_destroy_lock(__attribute__((unused)) struct ice_lock *sp) > > struct ice_hw; > >+static __rte_always_inline void * >+ice_memdup(__rte_unused struct ice_hw *hw, const void *src, size_t size, >+ __rte_unused enum ice_memcpy_type dir) >+{ >+ void *p; >+ >+ p = ice_malloc(hw, size); >+ if (p) >+ rte_memcpy(p, src, size); >+ >+ return p; >+} >+ > static inline void * > ice_alloc_dma_mem(__attribute__((unused)) struct ice_hw *hw, > struct ice_dma_mem *mem, u64 size) >-- >2.26.0 > Reviewed-by: Xiaolong Ye Applied to dpdk-next-net-intel, Thanks.