From: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
To: David Harton <dharton@cisco.com>, dev@dpdk.org
Cc: anatoly.burakov@intel.com
Subject: Re: [dpdk-dev] [PATCH] eal: fix rte_zalloc_socket to zero memory
Date: Sun, 9 Dec 2018 20:20:25 +0100 [thread overview]
Message-ID: <1f81a7b2-749c-e384-540c-741bf2a3162d@ericsson.com> (raw)
In-Reply-To: <20181207222420.9508-1-dharton@cisco.com>
On 2018-12-07 23:24, 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>
> ---
> lib/librte_eal/common/rte_malloc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
> index 0da5ad5e8..be382e534 100644
> --- a/lib/librte_eal/common/rte_malloc.c
> +++ b/lib/librte_eal/common/rte_malloc.c
> @@ -74,7 +74,9 @@ 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);
Maybe it would be worth to have a likely() here.
> + return new_ptr;
> }
>
> /*
>
next prev parent reply other threads:[~2018-12-09 19:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 22:24 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 [this message]
2018-12-09 20:11 ` [dpdk-dev] [PATCH v2] " David Harton
2018-12-10 16:21 ` Burakov, Anatoly
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=1f81a7b2-749c-e384-540c-741bf2a3162d@ericsson.com \
--to=mattias.ronnblom@ericsson.com \
--cc=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).