Skip to contentSkip to conversation

firmware: ti_sci: fix the secure_hdr in do_xfer

PATCH Superseded Dhruva Gole 1 participant 1 message Jan 24, 2024 Texas instruments' system control interface (TISCI) protocol driver

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 firmware: ti_sci: fix the secure_hdr in do_xfer

The secure_hdr needs to be 0 init-ed however this was never being put into the secure_buf, leading to possibility of the first 4 bytes of secure_buf being possibly garbage.

Fix this by initialising the secure_hdr itself to the secure_buf location, thus when we make it 0, it automatically ensures the first 4 bytes are 0.

Fixes 32cd25128bd849 ("firmware: Add basic support for TI System Control Interface (TI SCI)")

---

Boot tested for sanity on AM62x SK
https://gist.github.com/DhruvaG2000/724ceba3a0db03f4b0bff47de1160074

Changelog:
Rebased on top of latest master branch

Cc Nishanth Menon <[email protected]>
Cc Tom Rini <[email protected]>
Cc Neha Francis <[email protected]>
Cc Manorit Chawdhry <[email protected]>,
Cc Vignesh Raghavendra <[email protected]>,
Cc Kamlesh Gurudasani <[email protected]>
 drivers/firmware/ti_sci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/ti_sci.c +3 -3
index 6e9f93e9a302..f7675e383d47 100644
@@ -236,13 +236,13 @@ static int ti_sci_do_xfer(struct ti_sci_info *info,
 {
 	struct k3_sec_proxy_msg *msg = &xfer->tx_message;
 	u8 secure_buf[info->desc->max_msg_size];
-	struct ti_sci_secure_msg_hdr secure_hdr;
+	struct ti_sci_secure_msg_hdr *secure_hdr = (struct ti_sci_secure_msg_hdr *)secure_buf;
 	int ret;
 
 	if (info->is_secure) {
 		/* ToDo: get checksum of the entire message */
-		secure_hdr.checksum = 0;
-		secure_hdr.reserved = 0;
+		secure_hdr->checksum = 0;
+		secure_hdr->reserved = 0;
 		memcpy(&secure_buf[sizeof(secure_hdr)], xfer->tx_message.buf,
 		       xfer->tx_message.len);
 

base-commit: 15e7927b5a2d33666af19879577bf0c30ab088fe

Signature · 1 line
2.34.1