Skip to content

Commit cd84036

Browse files
quic-bjorandeandersson
authored andcommitted
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>
1 parent 9f9967f commit cd84036

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/soc/qcom/mdt_loader.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static bool mdt_header_valid(const struct firmware *fw)
4949
return true;
5050
}
5151

52-
static bool mdt_phdr_valid(const struct elf32_phdr *phdr)
52+
static bool mdt_phdr_loadable(const struct elf32_phdr *phdr)
5353
{
5454
if (phdr->p_type != PT_LOAD)
5555
return false;
@@ -122,7 +122,7 @@ ssize_t qcom_mdt_get_size(const struct firmware *fw)
122122
for (i = 0; i < ehdr->e_phnum; i++) {
123123
phdr = &phdrs[i];
124124

125-
if (!mdt_phdr_valid(phdr))
125+
if (!mdt_phdr_loadable(phdr))
126126
continue;
127127

128128
if (phdr->p_paddr < min_addr)
@@ -260,7 +260,7 @@ int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw,
260260
for (i = 0; i < ehdr->e_phnum; i++) {
261261
phdr = &phdrs[i];
262262

263-
if (!mdt_phdr_valid(phdr))
263+
if (!mdt_phdr_loadable(phdr))
264264
continue;
265265

266266
if (phdr->p_flags & QCOM_MDT_RELOCATABLE)
@@ -360,7 +360,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
360360
for (i = 0; i < ehdr->e_phnum; i++) {
361361
phdr = &phdrs[i];
362362

363-
if (!mdt_phdr_valid(phdr))
363+
if (!mdt_phdr_loadable(phdr))
364364
continue;
365365

366366
if (phdr->p_flags & QCOM_MDT_RELOCATABLE)
@@ -387,7 +387,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
387387
for (i = 0; i < ehdr->e_phnum; i++) {
388388
phdr = &phdrs[i];
389389

390-
if (!mdt_phdr_valid(phdr))
390+
if (!mdt_phdr_loadable(phdr))
391391
continue;
392392

393393
offset = phdr->p_paddr - mem_reloc;

0 commit comments

Comments
 (0)