diff --git a/[refs] b/[refs] index ba7e997f7726..1567e0b7c099 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dd6da1c5e99a3b736b52370c504a2b8843cbfda6 +refs/heads/master: cf59d3e9a715fd2b6ff96e4a3a130fceded09a64 diff --git a/trunk/drivers/remoteproc/remoteproc_core.c b/trunk/drivers/remoteproc/remoteproc_core.c index 6212b82885d0..567a3c59b4af 100644 --- a/trunk/drivers/remoteproc/remoteproc_core.c +++ b/trunk/drivers/remoteproc/remoteproc_core.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "remoteproc_internal.h" @@ -851,6 +852,16 @@ static int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw) ehdr = (struct elf32_hdr *)fw->data; + /* We assume the firmware has the same endianess as the host */ +# ifdef __LITTLE_ENDIAN + if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { +# else /* BIG ENDIAN */ + if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) { +# endif + dev_err(dev, "Unsupported firmware endianess\n"); + return -EINVAL; + } + if (fw->size < ehdr->e_shoff + sizeof(struct elf32_shdr)) { dev_err(dev, "Image is too small\n"); return -EINVAL;