Skip to contentSkip to conversation

soc: qcom: smem: Fix endian-unaware access of num_entries

PATCH Applied Jens Reidel 2 participants 2 messages Jul 26, 2025 – Aug 12, 2025

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

PATCH 1/1 soc: qcom: smem: Fix endian-unaware access of num_entries

Add a missing le32_to_cpu when accessing num_entries, which is always a little endian integer.

Fixes booting on Xiaomi Mi 9T (xiaomi-davinci) in big endian.

---
 drivers/soc/qcom/smem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/smem.c +1 -1
index cf425930539e..c4c45f15dca4 100644
@@ -898,7 +898,7 @@ static u32 qcom_smem_get_item_count(struct qcom_smem *smem)
 	if (IS_ERR_OR_NULL(ptable))
 		return SMEM_ITEM_COUNT;
 
-	info = (struct smem_info *)&ptable->entry[ptable->num_entries];
+	info = (struct smem_info *)&ptable->entry[le32_to_cpu(ptable->num_entries)];
 	if (memcmp(info->magic, SMEM_INFO_MAGIC, sizeof(info->magic)))
 		return SMEM_ITEM_COUNT;
 
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Jens Reidel

Add a missing le32_to_cpu when accessing num_entries, which is always a little endian integer.

Fixes booting on Xiaomi Mi 9T (xiaomi-davinci) in big endian.

Applied, thanks!

[1/1] soc: qcom: smem: Fix endian-unaware access of num_entries

      commit: 19e7aa0e9e46d0ad111a4af55b3d681b6ad945e0

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>