DPDK patches and discussions
 help / color / mirror / Atom feed
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
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

  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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git