From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 4/4] handoff-data: add protection against multiple invocation
Date: Wed, 30 Oct 2024 12:30:39 +0100 [thread overview]
Message-ID: <20241030-handoff-data-v1-4-4403e0c62c2a@pengutronix.de> (raw)
In-Reply-To: <20241030-handoff-data-v1-0-4403e0c62c2a@pengutronix.de>
handoff_data_add_flags() passes statically allocated structs as handoff
data, thus we cannot allow it to be called multiple times as that would
reuse the same data. Add a BUG_ON() to catch this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
include/pbl/handoff-data.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/pbl/handoff-data.h b/include/pbl/handoff-data.h
index eac3b9bf3e..bc1d403380 100644
--- a/include/pbl/handoff-data.h
+++ b/include/pbl/handoff-data.h
@@ -28,6 +28,10 @@ struct handoff_data_entry {
#define handoff_data_add_flags(_cookie, _data, _size, _flags) \
do { \
static struct handoff_data_entry hde __section(.data); \
+ \
+ /* using static data, do not invoke multiple times */ \
+ BUG_ON(hde.cookie); \
+ \
hde.cookie = _cookie; \
hde.data = _data; \
hde.size = _size; \
--
2.39.5
prev parent reply other threads:[~2024-10-30 11:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 11:30 [PATCH 0/4] handoff-data: some update Sascha Hauer
2024-10-30 11:30 ` [PATCH 1/4] handoff_data: add handoff_data_add_dt() Sascha Hauer
2024-10-30 11:30 ` [PATCH 2/4] ARM: i.MX93: add destination argument to imx93_romapi_load_image() Sascha Hauer
2024-10-30 11:30 ` [PATCH 3/4] handoff-data: set flags of moved handoff data entry Sascha Hauer
2024-10-30 11:30 ` Sascha Hauer [this message]
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=20241030-handoff-data-v1-4-4403e0c62c2a@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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