Skip to content

Commit e69d24d

Browse files
Dan Carpentergregkh
authored andcommitted
soc: qcom: mdt_loader: Fix error return values in mdt_header_valid()
commit 9f35ab0 upstream. 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 <dan.carpenter@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/db57c01c-bdcc-4a0f-95db-b0f2784ea91f@sabinyo.mountain Signed-off-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3a0dc1f commit e69d24d

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)