Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: qcom: mdt_loader: Rename mdt_phdr_valid()

The function checks if a program header refers to a PT_LOAD segment,
that isn't a hash segment (which should be PT_LOAD in the first place),
andwith non-zero size. That's not the definition of "valid", but rather
if it's "loadable".

Rename the function to reflect what it does.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250610-mdt-loader-validation-and-fixes-v2-2-f7073e9ab899@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Bjorn Andersson and committed by
Bjorn Andersson
cd840362 9f9967fe

+5 -5
+5 -5
drivers/soc/qcom/mdt_loader.c
··· 49 49 return true; 50 50 } 51 51 52 - static bool mdt_phdr_valid(const struct elf32_phdr *phdr) 52 + static bool mdt_phdr_loadable(const struct elf32_phdr *phdr) 53 53 { 54 54 if (phdr->p_type != PT_LOAD) 55 55 return false; ··· 122 122 for (i = 0; i < ehdr->e_phnum; i++) { 123 123 phdr = &phdrs[i]; 124 124 125 - if (!mdt_phdr_valid(phdr)) 125 + if (!mdt_phdr_loadable(phdr)) 126 126 continue; 127 127 128 128 if (phdr->p_paddr < min_addr) ··· 260 260 for (i = 0; i < ehdr->e_phnum; i++) { 261 261 phdr = &phdrs[i]; 262 262 263 - if (!mdt_phdr_valid(phdr)) 263 + if (!mdt_phdr_loadable(phdr)) 264 264 continue; 265 265 266 266 if (phdr->p_flags & QCOM_MDT_RELOCATABLE) ··· 360 360 for (i = 0; i < ehdr->e_phnum; i++) { 361 361 phdr = &phdrs[i]; 362 362 363 - if (!mdt_phdr_valid(phdr)) 363 + if (!mdt_phdr_loadable(phdr)) 364 364 continue; 365 365 366 366 if (phdr->p_flags & QCOM_MDT_RELOCATABLE) ··· 387 387 for (i = 0; i < ehdr->e_phnum; i++) { 388 388 phdr = &phdrs[i]; 389 389 390 - if (!mdt_phdr_valid(phdr)) 390 + if (!mdt_phdr_loadable(phdr)) 391 391 continue; 392 392 393 393 offset = phdr->p_paddr - mem_reloc;