From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: David Harton <dharton@cisco.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] eal: fix rte_zalloc_socket to zero memory
Date: Mon, 10 Dec 2018 16:21:32 +0000 [thread overview]
Message-ID: <4681b8be-1b94-a12a-2f25-79471bc1c338@intel.com> (raw)
In-Reply-To: <20181209201120.36072-1-dharton@cisco.com>
On 09-Dec-18 8:11 PM, David Harton wrote:
> The zalloc and calloc functions do not actually zero the memory.
> Added memset to rte_zmalloc_socket() so allocated memory is cleared.
>
> Signed-off-by: David Harton <dharton@cisco.com>
> ---
>
> v2 Indented if clause
>
> lib/librte_eal/common/rte_malloc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
> index 0da5ad5e8..40a5384ff 100644
> --- a/lib/librte_eal/common/rte_malloc.c
> +++ b/lib/librte_eal/common/rte_malloc.c
> @@ -74,7 +74,10 @@ rte_malloc(const char *type, size_t size, unsigned align)
> void *
> rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
> {
> - return rte_malloc_socket(type, size, align, socket);
> + void *new_ptr = rte_malloc_socket(type, size, align, socket);
> + if (new_ptr)
> + memset(new_ptr, 0, size);
> + return new_ptr;
> }
>
> /*
>
NAK, see comments to v1.
TL;DR this is not needed, rte_free does memset(0). If there are
circumstances where some memory is not erased, this is a bug and should
be fixed at the source.
--
Thanks,
Anatoly
next prev parent reply other threads:[~2018-12-10 16:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 22:24 [dpdk-dev] [PATCH] " David Harton
2018-12-07 23:41 ` Wiles, Keith
2018-12-07 23:47 ` David Harton (dharton)
2018-12-07 23:51 ` Wiles, Keith
2018-12-07 23:54 ` Wiles, Keith
2018-12-09 19:20 ` Mattias Rönnblom
2018-12-09 20:11 ` [dpdk-dev] [PATCH v2] " David Harton
2018-12-10 16:21 ` Burakov, Anatoly [this message]
2018-12-10 10:26 ` [dpdk-dev] [PATCH] " Bruce Richardson
2018-12-10 10:45 ` Burakov, Anatoly
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=4681b8be-1b94-a12a-2f25-79471bc1c338@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=dharton@cisco.com \
/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).