Skip to contentSkip to conversation

remoteproc: qcom: pil-info: Fix shift overflow

PATCH Applied Bjorn Andersson 3 participants 3 messages Jul 16, 2020 – Jul 18, 2020

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

PATCH 1/1 remoteproc: qcom: pil-info: Fix shift overflow

On platforms with 32-bit phys_addr_t the shift to get the upper word of the base address of the memory region is invalid. Cast the base to 64 bit to resolv this.

Fixes 549b67da660d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")
---
 drivers/remoteproc/qcom_pil_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/qcom_pil_info.c +1 -1
index 0536e3904669..5521c4437ffa 100644
@@ -108,7 +108,7 @@ int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size)
 found_existing:
 	/* Use two writel() as base is only aligned to 4 bytes on odd entries */
 	writel(base, entry + PIL_RELOC_NAME_LEN);
-	writel(base >> 32, entry + PIL_RELOC_NAME_LEN + 4);
+	writel((u64)base >> 32, entry + PIL_RELOC_NAME_LEN + 4);
 	writel(size, entry + PIL_RELOC_NAME_LEN + sizeof(__le64));
 	mutex_unlock(&pil_reloc_lock);
 
Signature · 1 line
2.26.2
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bjorn Andersson

On platforms with 32-bit phys_addr_t the shift to get the upper word of the base address of the memory region is invalid. Cast the base to 64 bit to resolv this.

Fixes 549b67da660d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")
Quoted 20 lines
---
 drivers/remoteproc/qcom_pil_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/qcom_pil_info.c +1 -1
index 0536e3904669..5521c4437ffa 100644
@@ -108,7 +108,7 @@ int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size)
 found_existing:
 	/* Use two writel() as base is only aligned to 4 bytes on odd entries */
 	writel(base, entry + PIL_RELOC_NAME_LEN);
-	writel(base >> 32, entry + PIL_RELOC_NAME_LEN + 4);
+	writel((u64)base >> 32, entry + PIL_RELOC_NAME_LEN + 4);
 	writel(size, entry + PIL_RELOC_NAME_LEN + sizeof(__le64));
 	mutex_unlock(&pil_reloc_lock);
 
Signature · 1 line
2.26.2
#2 lore raw
In reply to Bjorn Andersson
This patch was applied to andersson/remoteproc.git (refs/heads/for-next).

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next).

Quoted 10 lines · On Wed, 15 Jul 2020 22:48:17 -0700 you wrote:

On platforms with 32-bit phys_addr_t the shift to get the upper word of the base address of the memory region is invalid. Cast the base to 64 bit to resolv this.

Fixes 549b67da660d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")

[...]

Here is a summary with links:
- remoteproc: qcom: pil-info: Fix shift overflow

    https://git.kernel.org/andersson/remoteproc/c/90ec257c380ebdcebf332b698f3e809cd1157202

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot