Skip to content

Commit 1e6a4eb

Browse files
cdleonardShawn Guo
authored andcommitted
firmware: imx: misc: Align imx sc msg structs to 4
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: 15e1f2b ("firmware: imx: add misc svc support") Signed-off-by: Leonard Crestez <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 26d0fba commit 1e6a4eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/firmware/imx/misc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct imx_sc_msg_req_misc_set_ctrl {
1616
u32 ctrl;
1717
u32 val;
1818
u16 resource;
19-
} __packed;
19+
} __packed __aligned(4);
2020

2121
struct imx_sc_msg_req_cpu_start {
2222
struct imx_sc_rpc_msg hdr;
@@ -30,12 +30,12 @@ struct imx_sc_msg_req_misc_get_ctrl {
3030
struct imx_sc_rpc_msg hdr;
3131
u32 ctrl;
3232
u16 resource;
33-
} __packed;
33+
} __packed __aligned(4);
3434

3535
struct imx_sc_msg_resp_misc_get_ctrl {
3636
struct imx_sc_rpc_msg hdr;
3737
u32 val;
38-
} __packed;
38+
} __packed __aligned(4);
3939

4040
/*
4141
* This function sets a miscellaneous control value.

0 commit comments

Comments
 (0)