remoteproc: remove rproc_elf32_sanity_check
authorClement Leger <cleger@kalray.eu>
Wed, 22 Apr 2020 09:30:17 +0000 (11:30 +0200)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 23 Apr 2020 04:57:26 +0000 (21:57 -0700)
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>
drivers/remoteproc/remoteproc_core.c
drivers/remoteproc/remoteproc_elf_loader.c
drivers/remoteproc/remoteproc_internal.h
drivers/remoteproc/st_remoteproc.c
drivers/remoteproc/st_slim_rproc.c
drivers/remoteproc/stm32_rproc.c

index 448262470fc78688fcab0f3e81692bfa2be0de5c..206363723071909f02a9fd5ae4ac76495985f344 100644 (file)
@@ -2069,8 +2069,7 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
        rproc->ops->load = rproc_elf_load_segments;
        rproc->ops->parse_fw = rproc_elf_load_rsc_table;
        rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table;
-       if (!rproc->ops->sanity_check)
-               rproc->ops->sanity_check = rproc_elf32_sanity_check;
+       rproc->ops->sanity_check = rproc_elf_sanity_check;
        rproc->ops->get_boot_addr = rproc_elf_get_boot_addr;
 
        return 0;
index 4869fb7d8fe42c53d45d56bc1bcac587d2fcde47..df68d87752e4858d3ef4486ec00f61658911a00d 100644 (file)
@@ -112,27 +112,6 @@ int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw)
 }
 EXPORT_SYMBOL(rproc_elf_sanity_check);
 
-/**
- * rproc_elf_sanity_check() - Sanity Check ELF32 firmware image
- * @rproc: the remote processor handle
- * @fw: the ELF32 firmware image
- *
- * Make sure this fw image is sane.
- */
-int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw)
-{
-       int ret = rproc_elf_sanity_check(rproc, fw);
-
-       if (ret)
-               return ret;
-
-       if (fw_elf_get_class(fw) == ELFCLASS32)
-               return 0;
-
-       return -EINVAL;
-}
-EXPORT_SYMBOL(rproc_elf32_sanity_check);
-
 /**
  * rproc_elf_get_boot_addr() - Get rproc's boot address.
  * @rproc: the remote processor handle
index b389dc79da81176baeab7fdcb4c3db12aa0cc7e5..31994715fd437c5152e27e159b830d887e1ccde8 100644 (file)
@@ -54,7 +54,6 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len);
 phys_addr_t rproc_va_to_pa(void *cpu_addr);
 int rproc_trigger_recovery(struct rproc *rproc);
 
-int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw);
 int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
 u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
 int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
index a6cbfa45276463348d6c6937b6be03cb0fb7106b..a3268d95a50e68248ef34ab89aa59f76d7f47965 100644 (file)
@@ -233,7 +233,7 @@ static const struct rproc_ops st_rproc_ops = {
        .parse_fw               = st_rproc_parse_fw,
        .load                   = rproc_elf_load_segments,
        .find_loaded_rsc_table  = rproc_elf_find_loaded_rsc_table,
-       .sanity_check           = rproc_elf32_sanity_check,
+       .sanity_check           = rproc_elf_sanity_check,
        .get_boot_addr          = rproc_elf_get_boot_addr,
 };
 
index 3cca8b65a8dba3046561c52461b48c21dfaba189..09bcb4d8b9e03b4cfcf3a96f87d892cc8cf8b005 100644 (file)
@@ -203,7 +203,7 @@ static const struct rproc_ops slim_rproc_ops = {
        .da_to_va       = slim_rproc_da_to_va,
        .get_boot_addr  = rproc_elf_get_boot_addr,
        .load           = rproc_elf_load_segments,
-       .sanity_check   = rproc_elf32_sanity_check,
+       .sanity_check   = rproc_elf_sanity_check,
 };
 
 /**
index 0f9d02ca4f5ac53d7a1d824107e9fb792929020c..f45b8d597da0cdea573898c3683009f3b15afd0d 100644 (file)
@@ -505,7 +505,7 @@ static struct rproc_ops st_rproc_ops = {
        .load           = rproc_elf_load_segments,
        .parse_fw       = stm32_rproc_parse_fw,
        .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
-       .sanity_check   = rproc_elf32_sanity_check,
+       .sanity_check   = rproc_elf_sanity_check,
        .get_boot_addr  = rproc_elf_get_boot_addr,
 };