summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorWeigang He <geoffreyhe2@gmail.com>2026-09-26 14:28:53 +1000
committerMiquel Raynal <miquel.raynal@bootlin.com>2026-10-12 20:25:02 +0200
commit2f7fa8d90694d21dce68ceabd8383252b111cfea (patch)
treec6be1d8b06b83a791cc3513ed64ac8a00bd667ba /scripts/Makefile.thinlto
parent112a666bd82e96e4a01e0cd8a0fb9c88dd0bce38 (diff)
downloadlinux-2f7fa8d90694d21dce68ceabd8383252b111cfea.tar.gz
linux-2f7fa8d90694d21dce68ceabd8383252b111cfea.zip
mtd: parsers: qcom: fix offset/size overflow on large partitions
In parse_qcomsmem_part() the partition offset and size are computed as parts[j].offset = le32_to_cpu(pentry->offset) * mtd->erasesize; parts[j].size = le32_to_cpu(pentry->length) * mtd->erasesize; Both le32_to_cpu() and mtd->erasesize are 32-bit (u32). The multiply is therefore evaluated in 32-bit arithmetic and the product is truncated to 32 bits before being widened and stored into the 64-bit (u64) parts[j].offset / parts[j].size fields, so the 64-bit destinations are never used at their full width. The SMEM partition table is firmware-provided and the per-entry offset and length are not bounds-checked against the device geometry (only numparts is capped). On a sufficiently large flash, a partition whose (offset|length) * erasesize is >= 2^32 gets a silently truncated offset/size and is mapped to the wrong region of the master MTD, which can overlap or extend into an unintended area. Cast one operand to u64 so the multiplication is performed in 64-bit and the result fits the 64-bit fields without truncation. Found by static analysis tool CodeQL. Fixes: 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser") Cc: stable@vger.kernel.org Assisted-by: LLM codeql Signed-off-by: Weigang He <geoffreyhe2@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions