Re: [PATCH] soc: qcom: mdt_loader: Fix error return values in mdt_header_valid()

From: Val Packett
Date: Mon Jul 21 2025 - 19:35:48 EST


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