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

remoteproc: remove rproc_elf32_sanity_check

Since checks are present in the remoteproc elf loader before calling
da_to_va, loading a elf64 will work on 32bits flavors of kernel.
Indeed, if a segment size is larger than what size_t can hold, the
loader will return an error so the functionality is equivalent to
what exists today.

Acked-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Clement Leger <cleger@kalray.eu>
Link: https://lore.kernel.org/r/20200422093017.10985-1-cleger@kalray.eu
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

authored by

Clement Leger and committed by
Bjorn Andersson
e29ff72b 305ac5a7

+4 -27
+1 -2
drivers/remoteproc/remoteproc_core.c
··· 2069 2069 rproc->ops->load = rproc_elf_load_segments; 2070 2070 rproc->ops->parse_fw = rproc_elf_load_rsc_table; 2071 2071 rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table; 2072 - if (!rproc->ops->sanity_check) 2073 - rproc->ops->sanity_check = rproc_elf32_sanity_check; 2072 + rproc->ops->sanity_check = rproc_elf_sanity_check; 2074 2073 rproc->ops->get_boot_addr = rproc_elf_get_boot_addr; 2075 2074 2076 2075 return 0;
-21
drivers/remoteproc/remoteproc_elf_loader.c
··· 113 113 EXPORT_SYMBOL(rproc_elf_sanity_check); 114 114 115 115 /** 116 - * rproc_elf_sanity_check() - Sanity Check ELF32 firmware image 117 - * @rproc: the remote processor handle 118 - * @fw: the ELF32 firmware image 119 - * 120 - * Make sure this fw image is sane. 121 - */ 122 - int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw) 123 - { 124 - int ret = rproc_elf_sanity_check(rproc, fw); 125 - 126 - if (ret) 127 - return ret; 128 - 129 - if (fw_elf_get_class(fw) == ELFCLASS32) 130 - return 0; 131 - 132 - return -EINVAL; 133 - } 134 - EXPORT_SYMBOL(rproc_elf32_sanity_check); 135 - 136 - /** 137 116 * rproc_elf_get_boot_addr() - Get rproc's boot address. 138 117 * @rproc: the remote processor handle 139 118 * @fw: the ELF firmware image
-1
drivers/remoteproc/remoteproc_internal.h
··· 54 54 phys_addr_t rproc_va_to_pa(void *cpu_addr); 55 55 int rproc_trigger_recovery(struct rproc *rproc); 56 56 57 - int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw); 58 57 int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw); 59 58 u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw); 60 59 int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
+1 -1
drivers/remoteproc/st_remoteproc.c
··· 233 233 .parse_fw = st_rproc_parse_fw, 234 234 .load = rproc_elf_load_segments, 235 235 .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, 236 - .sanity_check = rproc_elf32_sanity_check, 236 + .sanity_check = rproc_elf_sanity_check, 237 237 .get_boot_addr = rproc_elf_get_boot_addr, 238 238 }; 239 239
+1 -1
drivers/remoteproc/st_slim_rproc.c
··· 203 203 .da_to_va = slim_rproc_da_to_va, 204 204 .get_boot_addr = rproc_elf_get_boot_addr, 205 205 .load = rproc_elf_load_segments, 206 - .sanity_check = rproc_elf32_sanity_check, 206 + .sanity_check = rproc_elf_sanity_check, 207 207 }; 208 208 209 209 /**
+1 -1
drivers/remoteproc/stm32_rproc.c
··· 505 505 .load = rproc_elf_load_segments, 506 506 .parse_fw = stm32_rproc_parse_fw, 507 507 .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, 508 - .sanity_check = rproc_elf32_sanity_check, 508 + .sanity_check = rproc_elf_sanity_check, 509 509 .get_boot_addr = rproc_elf_get_boot_addr, 510 510 }; 511 511