From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Haiyue Wang <haiyue.wang@intel.com>
Cc: dev@dpdk.org, qi.z.zhang@intel.com, qiming.yang@intel.com,
beilei.xing@intel.com, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1] net/ice/base: check memory pointer before copying
Date: Wed, 1 Apr 2020 11:30:52 +0800 [thread overview]
Message-ID: <20200401033052.GK29805@intel.com> (raw)
In-Reply-To: <20200331065034.4853-1-haiyue.wang@intel.com>
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 <haiyue.wang@intel.com>
>---
> 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 <rte_random.h>
> #include <rte_io.h>
>
>+#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 <xiaolong.ye@intel.com>
Applied to dpdk-next-net-intel, Thanks.
prev parent reply other threads:[~2020-04-01 3:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 6:50 Haiyue Wang
2020-04-01 3:30 ` Ye Xiaolong [this message]
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=20200401033052.GK29805@intel.com \
--to=xiaolong.ye@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=haiyue.wang@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.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).