From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] eal/rte_malloc: add alloc_size() attribute to allocation functions
Date: Mon, 14 Sep 2020 16:35:58 +0100 [thread overview]
Message-ID: <6a912a3a-81c2-7740-5f89-815d2e5fba5d@intel.com> (raw)
In-Reply-To: <20200904221143.19744-1-stephen@networkplumber.org>
On 04-Sep-20 11:11 PM, Stephen Hemminger wrote:
> By using the alloc_size() attribute the compiler can optimize
> better and detect errors at compile time.
>
> For example, Gcc will fail one of the invalid allocation examples
> in app/test/test_malloc.c because the allocation is outside the
> limits of memory.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
This is a very cool feature! LGTM
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> void *
> -rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
> +rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
> + __rte_alloc_size(2);
>
> /**
> * Replacement function for calloc(), using huge-page memory. Memory area is
> @@ -239,9 +243,9 @@ rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
> * align is not a power of two).
> * - Otherwise, the pointer to the allocated object.
> */
> -__rte_malloc
> void *
Where did this come from?
> -rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);
> +rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
> + __rte_alloc_size(2, 3);
>
> /**
> * Frees the memory space pointed to by the provided pointer.
>
--
Thanks,
Anatoly
next prev parent reply other threads:[~2020-09-14 15:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 22:11 Stephen Hemminger
2020-09-14 15:35 ` Burakov, Anatoly [this message]
2020-09-14 16:40 ` Stephen Hemminger
2020-10-14 23:02 ` Thomas Monjalon
2020-10-19 10:23 ` Thomas Monjalon
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=6a912a3a-81c2-7740-5f89-815d2e5fba5d@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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).