From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 07DB9A04DC;
	Mon, 19 Oct 2020 16:22:37 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id F148EE241;
	Mon, 19 Oct 2020 16:22:34 +0200 (CEST)
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 90503E240
 for <dev@dpdk.org>; Mon, 19 Oct 2020 16:22:33 +0200 (CEST)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id 314FF5C01C4;
 Mon, 19 Oct 2020 10:22:32 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Mon, 19 Oct 2020 10:22:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm2; bh=
 Oc5bOtnh1A4DxHgZCvPFDjerIsewW3RVNjR3DY7Kphc=; b=I7bArx+gBrgw1fu4
 FJgeUzvTrZYaUXHiXK+DHhNuCkg3262EWSOKjC3t5GJWqy8BRjRnu38O2PLXFyUh
 dhk3U3y2gEiFV5SOitMZlQ4CcZNqmWddDkVvXV48kXRl6Up/FpQtErgjaf/piDSQ
 0FiXf09tDLq9yuEYxGGLUGaGErRoyn8hDJq64ZMXmI3yFSyxrEaNYJNmHtVten4X
 aq/LOSyJAcMyocOWw2GLn0es0ouluVtyNC/y7YHY5pXUEJZEDqy17NgHC21EAfbt
 9w4RKe4G6T/HE9zRR/lgZe7BGpXUmS//rTx4eoxhCDbj+NXVhNMeN7I17jLp0Rm7
 mTJARQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=Oc5bOtnh1A4DxHgZCvPFDjerIsewW3RVNjR3DY7Kp
 hc=; b=qlAZGrbR42Y0e8l2UQb7kqkco9bhvilURxMqGItQQpbMPxK2NugVYNX9s
 CsFb8QK0Wv0AT0uNZLpO7y0wdN1FqeC1Ra24t9NOmO82+UpObQoKEPCw/qV0ttTC
 9pq6mUq8Bvzea2YqT0fs8x/SsyOwNI8NUwWeyCCh5bjujjX9I/++xr6hKzKB3PLy
 zQmukUukCh7clpW9Q7hGvTZf9acofWF9yptyojTjjDiu5JBJwuItidCRrHsHHFOU
 WrBVwAwHIbJrR56gqhHUW7zWytfGFTTMFA3tL4PWu8INxu24eTfT4mHlUKjE0AEG
 Y4od4M9CC/5GEJHnNy5y6sIJl3sfg==
X-ME-Sender: <xms:J6GNX_z7rSzLdwWm5X18Ru9SDIB-uYd51NpdXeFbAXZ2f137ef2UMg>
 <xme:J6GNX3TOvnKyQyfM9ITjbtnjtGdXv5cFOY7S4-mW5MC680sEPzD7JbGcfXk2csa9Y
 bj8Ek46ibBu3mHWMQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrjedugdejjecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf
 frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei
 iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih
 iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho
 nhdrnhgvth
X-ME-Proxy: <xmx:J6GNX5V3CitSq7jdTbdcLWA9fS8U0YZ0bgXyOcCP5KxDW4SxiZpYBw>
 <xmx:J6GNX5g0JHOGw3PVKlcx2b-iHV9bghcqcI1JnKFMIRBtAEve9uir3w>
 <xmx:J6GNXxC5DhYS3QlAWa3LWh4Uh4I2s0NCQ-VAlY9q0C8hS1mLEnEqFg>
 <xmx:KKGNX-46pHGZCyVWnxPxBINHvHic8O4mMUJUIyx-xy5YUbhRCQa0-A>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id DE214328006F;
 Mon, 19 Oct 2020 10:22:30 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, anatoly.burakov@intel.com, david.marchand@redhat.com
Date: Mon, 19 Oct 2020 16:22:29 +0200
Message-ID: <2268678.gA76BeBgmz@thomas>
In-Reply-To: <11702768.X94JZly3y1@thomas>
References: <MWHPR12MB136076E652230CEBD6EE6562DF5F0@MWHPR12MB1360.namprd12.prod.outlook.com>
 <20201015005524.24659-1-stephen@networkplumber.org>
 <11702768.X94JZly3y1@thomas>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH v2] eal/rte_malloc: add alloc_size()
	attribute to allocation functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

19/10/2020 16:13, Thomas Monjalon:
> 15/10/2020 02:55, Stephen Hemminger:
> > 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>
> > ---
> > v2 - rebase onto correct branch (main)
> [...]
> > +/**
> > + * Tells compiler that the function returns a value that points to
> > + * memory, where the size is given by the one or two arguments.
> > + * Used by compiler to validate object size.
> > + */
> > +#if defined(RTE_CC_GCC) || defined(RTE_CC_CLANG)
> > +#define __rte_alloc_size(...) \
> > +	__attribute__((alloc_size(__VA_ARGS__)))
> > +#else
> > +#define __rte_alloc_size(...)
> > +#endif
> 
> Not sure about the rebase: RTE_CC_GCC and RTE_CC_CLANG don't exist.

Actually no, I forgot my 7-month old patch introducing them.

Applied, thanks