From: Leonard Crestez <leonard.crestez@nxp.com>
To: Shawn Guo <shawnguo@kernel.org>, Dong Aisheng <aisheng.dong@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Stefan Agner <stefan@agner.ch>,
Linus Walleij <linus.walleij@linaro.org>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Anson Huang <anson.huang@nxp.com>, Abel Vesa <abel.vesa@nxp.com>,
Franck LENORMAND <franck.lenormand@nxp.com>,
kernel@pengutronix.de, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org
Subject: [PATCH v2 3/8] firmware: imx: misc: Align imx sc msg structs to 4
Date: Thu, 20 Feb 2020 18:29:34 +0200 [thread overview]
Message-ID: <582b80361beb66bd1844fda785aac2e800155d64.1582216144.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1582216144.git.leonard.crestez@nxp.com>
In-Reply-To: <cover.1582216144.git.leonard.crestez@nxp.com>
The imx SC api strongly assumes that messages are composed out of
4-bytes words but some of our message structs have odd sizeofs.
This produces many oopses with CONFIG_KASAN=y:
BUG: KASAN: stack-out-of-bounds in imx_mu_send_data+0x108/0x1f0
It shouldn't cause an issues in normal use because these structs are
always allocated on the stack.
Fixes: 15e1f2bc8b3b ("firmware: imx: add misc svc support")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
drivers/firmware/imx/misc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c
index 4b56a587dacd..6a21ff942f82 100644
--- a/drivers/firmware/imx/misc.c
+++ b/drivers/firmware/imx/misc.c
@@ -14,11 +14,11 @@
struct imx_sc_msg_req_misc_set_ctrl {
struct imx_sc_rpc_msg hdr;
u32 ctrl;
u32 val;
u16 resource;
-} __packed;
+} __packed __aligned(4);
struct imx_sc_msg_req_cpu_start {
struct imx_sc_rpc_msg hdr;
u32 address_hi;
u32 address_lo;
@@ -28,16 +28,16 @@ struct imx_sc_msg_req_cpu_start {
struct imx_sc_msg_req_misc_get_ctrl {
struct imx_sc_rpc_msg hdr;
u32 ctrl;
u16 resource;
-} __packed;
+} __packed __aligned(4);
struct imx_sc_msg_resp_misc_get_ctrl {
struct imx_sc_rpc_msg hdr;
u32 val;
-} __packed;
+} __packed __aligned(4);
/*
* This function sets a miscellaneous control value.
*
* @param[in] ipc IPC handle
--
2.17.1
next prev parent reply other threads:[~2020-02-20 16:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 16:29 [PATCH v2 0/8] firmware: imx: Align imx SC msg structs to 4 Leonard Crestez
2020-02-20 16:29 ` [PATCH v2 1/8] clk: imx: Align imx sc clock " Leonard Crestez
2020-02-24 7:22 ` Shawn Guo
2020-03-16 0:25 ` Shawn Guo
2020-02-25 16:51 ` Stephen Boyd
2020-02-25 19:52 ` Leonard Crestez
2020-03-16 8:52 ` Aisheng Dong
2020-02-20 16:29 ` [PATCH v2 2/8] clk: imx: Align imx sc clock parent " Leonard Crestez
2020-02-24 7:23 ` Shawn Guo
2020-02-20 16:29 ` Leonard Crestez [this message]
2020-02-24 7:28 ` [PATCH v2 3/8] firmware: imx: misc: Align imx sc " Shawn Guo
2020-02-20 16:29 ` [PATCH v2 4/8] firmware: imx: scu-pd: " Leonard Crestez
2020-02-24 7:28 ` Shawn Guo
2020-02-20 16:29 ` [PATCH v2 5/8] firmware: imx: Align imx_sc_msg_req_cpu_start " Leonard Crestez
2020-02-24 7:28 ` Shawn Guo
2020-02-20 16:29 ` [PATCH v2 6/8] pinctrl: imx: scu: Align imx sc msg structs " Leonard Crestez
2020-02-21 15:34 ` Linus Walleij
2020-02-20 16:29 ` [PATCH v2 7/8] rtc: imx-sc: " Leonard Crestez
2020-03-03 11:02 ` Alexandre Belloni
2020-02-20 16:29 ` [PATCH v2 8/8] soc: imx-scu: " Leonard Crestez
2020-02-24 7:30 ` Shawn Guo
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=582b80361beb66bd1844fda785aac2e800155d64.1582216144.git.leonard.crestez@nxp.com \
--to=leonard.crestez@nxp.com \
--cc=a.zummo@towertech.it \
--cc=abel.vesa@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=anson.huang@nxp.com \
--cc=fabio.estevam@nxp.com \
--cc=franck.lenormand@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-rtc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
--cc=stefan@agner.ch \
/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).