Skip to contentSkip to conversation

soc: qcom: mdt_loader: Fix split-firmware condition

PATCH Applied Bjorn Andersson 2 participants 3 messages Feb 15, 2022 – Feb 24, 2022

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

PATCH 1/1 soc: qcom: mdt_loader: Fix split-firmware condition

The updated condition checking if a segment can be found in the loaded firmware blob, or need to be loaded from a separate file, incorrectly classifies segments that ends at the end of the loaded blob. The result is that the mdt loader attempts to load the segment from a separate file.

Correct the conditional to use the loaded segment instead.

Fixes ea90330fa329 ("soc: qcom: mdt_loader: Extend check for split firmware")
---
 drivers/soc/qcom/mdt_loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/mdt_loader.c +1 -1
index f0b1d969567c..366db493579b 100644
@@ -329,7 +329,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
 		ptr = mem_region + offset;
 
 		if (phdr->p_filesz && phdr->p_offset < fw->size &&
-		    phdr->p_offset + phdr->p_filesz < fw->size) {
+		    phdr->p_offset + phdr->p_filesz <= fw->size) {
 			/* Firmware is large enough to be non-split */
 			if (phdr->p_offset + phdr->p_filesz > fw->size) {
 				dev_err(dev, "file %s segment %d would be truncated\n",
Signature · 1 line
2.33.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Bjorn Andersson

The updated condition checking if a segment can be found in the loaded firmware blob, or need to be loaded from a separate file, incorrectly classifies segments that ends at the end of the loaded blob. The result is that the mdt loader attempts to load the segment from a separate file.

Correct the conditional to use the loaded segment instead.

Fixes ea90330fa329 ("soc: qcom: mdt_loader: Extend check for split firmware")
Signature · 1 line
~Vinod
author Applied
#2 lore raw

Re: (subset) [PATCH] soc: qcom: mdt_loader: Fix split-firmware condition

In reply to Bjorn Andersson
Quoted 9 lines · Bjorn Andersson

The updated condition checking if a segment can be found in the loaded firmware blob, or need to be loaded from a separate file, incorrectly classifies segments that ends at the end of the loaded blob. The result is that the mdt loader attempts to load the segment from a separate file.

Correct the conditional to use the loaded segment instead.

[...]

Applied, thanks!

[1/1] soc: qcom: mdt_loader: Fix split-firmware condition

      commit: a1b019872693c74d919db4e267f451fc7af9a21c

Best regards,

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