Skip to contentSkip to conversation

thermal: imx_sc_thermal: Align imx sc thermal msg structs to 4

PATCH Applied Anson Huang 2 participants 2 messages Mar 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: imx_sc_thermal: Align imx sc thermal msg structs to 4

The i.MX SCU API strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs, use __packed __aligned(4) to avoid potential oopses.

---
This patch is based on https://patchwork.kernel.org/patch/11397719/ which is accepted.

---
 drivers/thermal/imx_sc_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/imx_sc_thermal.c +3 -3
index 4955dfd..dbb277a 100644
@@ -27,12 +27,12 @@ struct imx_sc_sensor {
 struct req_get_temp {
 	u16 resource_id;
 	u8 type;
-} __packed;
+} __packed __aligned(4);
 
 struct resp_get_temp {
 	u16 celsius;
 	u8 tenths;
-} __packed;
+} __packed __aligned(4);
 
 struct imx_sc_msg_misc_get_temp {
 	struct imx_sc_rpc_msg hdr;
@@ -40,7 +40,7 @@ struct imx_sc_msg_misc_get_temp {
 		struct req_get_temp req;
 		struct resp_get_temp resp;
 	} data;
-};
+} __packed __aligned(4);
 
 static int imx_sc_thermal_get_temp(void *data, int *temp)
 {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Anson Huang

The i.MX SCU API strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs, use __packed __aligned(4) to avoid potential oopses.

---

Applied, thanks

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog