Skip to content

Commit 9f35ab0

Browse files
Dan Carpenterandersson
authored andcommitted
soc: qcom: mdt_loader: Fix error return values in mdt_header_valid()
This function is supposed to return true for valid headers and false for invalid. In a couple places it returns -EINVAL instead which means the invalid headers are counted as true. Change it to return false. Fixes: 9f9967f ("soc: qcom: mdt_loader: Ensure we don't read past the ELF header") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 9cea10a commit 9f35ab0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/soc/qcom/mdt_loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ static bool mdt_header_valid(const struct firmware *fw)
3333
return false;
3434

3535
if (ehdr->e_phentsize != sizeof(struct elf32_phdr))
36-
return -EINVAL;
36+
return false;
3737

3838
phend = size_add(size_mul(sizeof(struct elf32_phdr), ehdr->e_phnum), ehdr->e_phoff);
3939
if (phend > fw->size)
4040
return false;
4141

4242
if (ehdr->e_shentsize != sizeof(struct elf32_shdr))
43-
return -EINVAL;
43+
return false;
4444

4545
shend = size_add(size_mul(sizeof(struct elf32_shdr), ehdr->e_shnum), ehdr->e_shoff);
4646
if (shend > fw->size)

0 commit comments

Comments
 (0)