From: Val Packett <val@packett.cool>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] soc: qcom: mdt_loader: Fix error return values in mdt_header_valid()
Date: Mon, 21 Jul 2025 20:35:22 -0300 [thread overview]
Message-ID: <ece307c3-7d65-440f-babd-88cf9705b908@packett.cool> (raw)
In-Reply-To: <db57c01c-bdcc-4a0f-95db-b0f2784ea91f@sabinyo.mountain>
Hi,
On 6/25/25 12:22 PM, Dan Carpenter wrote:
> 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.
[..]
> if (ehdr->e_shentsize != sizeof(struct elf32_shdr))
> - return -EINVAL;
> + return false;
>
> shend = size_add(size_mul(sizeof(struct elf32_shdr), ehdr->e_shnum), ehdr->e_shoff);
> if (shend > fw->size)
this has broken all firmware loading on my x1e laptop (Dell Latitude 7455).
Apparently e_shentsize is always 0 in Qualcomm firmware files.
Confirmed externally with readelf:
% readelf --all
/lib/firmware/qcom/x1e80100/dell/latitude-7455/qcadsp8380.mbn
[..]
Start of program headers: 52 (bytes into file)
Start of section headers: 0 (bytes into file)
Flags: 0x73
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 58
Size of section headers: 0 (bytes)
Number of section headers: 0
Section header string table index: 0
There are no sections in this file.
There are no section groups in this file.
(Not just with my files, also readelf'd the Lenovo ones committed to
linux-firmware, same deal.)
Thanks,
~val
next prev parent reply other threads:[~2025-07-21 23:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 15:22 Dan Carpenter
2025-06-25 15:32 ` Konrad Dybcio
2025-07-21 23:35 ` Val Packett [this message]
2025-08-05 9:32 ` Dan Carpenter
2025-07-23 14:46 ` neil.armstrong
2025-07-23 15:46 ` Neil Armstrong
2025-07-23 16:16 ` Akhil P Oommen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ece307c3-7d65-440f-babd-88cf9705b908@packett.cool \
--to=val@packett.cool \
--cc=andersson@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®