From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Bruce Richardson" <bruce.richardson@intel.com>, <dev@dpdk.org>
Subject: RE: [PATCH v2 1/6] eal: add macros for local variable-length structure buffers
Date: Tue, 1 Dec 2026 20:29:46 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65B4A@smartserver.smartshare.dk> (raw)
In-Reply-To: <20261201182249.2520829-2-bruce.richardson@intel.com>
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Tuesday, 1 December 2026 19.23
>
> Many drivers allocate small control-path messages, which consist of a
> header structure followed by a variable-length array, using malloc and
> free, which adds error handling and the risk of leaks on error paths.
>
> Add RTE_DEFINE_FLEX and RTE_DEFINE_FLEX_BYTES macros to define such
> buffers on the stack instead, (similar to equivalent macros in Linux
> kernel). The buffer is a union of a byte array and the structure type,
> giving correct alignment and type-safe access via a pointer, with the
> byte array first so that zero-initialization covers the whole buffer.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
I thought we wanted to get rid of variable length arrays...
Could this be implemented using alloca() instead?
next prev parent reply other threads:[~2026-12-01 19:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:09 [PATCH 27.03 0/6] eliminate unnecessary dynamic allocation Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 1/6] eal: add macros for local variable-length structure buffers Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 2/6] net/iavf: use stack storage for virtchnl messages Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 3/6] net/ice: use stack storage for function-local buffers Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 4/6] net/idpf: use stack storage for virtchnl messages Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 5/6] net/cpfl: use stack storage for function-local buffers Bruce Richardson
2026-11-16 16:09 ` [PATCH 27.03 6/6] net/i40e: " Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 0/6] eliminate unnecessary dynamic allocation Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 1/6] eal: add macros for local variable-length structure buffers Bruce Richardson
2026-12-01 19:29 ` Morten Brørup [this message]
2026-12-01 19:36 ` Stephen Hemminger
2026-12-01 19:37 ` Stephen Hemminger
2026-12-01 18:22 ` [PATCH v2 2/6] net/iavf: use stack storage for virtchnl messages Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 3/6] net/ice: use stack storage for function-local buffers Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 4/6] net/idpf: use stack storage for virtchnl messages Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 5/6] net/cpfl: use stack storage for function-local buffers Bruce Richardson
2026-12-01 18:22 ` [PATCH v2 6/6] net/i40e: " Bruce Richardson
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=98CBD80474FA8B44BF855DF32C47DC35F65B4A@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.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