From 62369de79544adb3ca66fdc7d184cee7c0d40c11 Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen Date: Tue, 31 Jan 2012 15:23:41 +0200 Subject: [PATCH] --- yaml --- r: 295995 b: refs/heads/master c: cf59d3e9a715fd2b6ff96e4a3a130fceded09a64 h: refs/heads/master i: 295993: 44fcdfb1a4735ab1f7bb84c795989e53e8f29f70 295991: 6bef0b87839f6bfc28be11ff05bf565456ddff89 v: v3 --- [refs] | 2 +- trunk/drivers/remoteproc/remoteproc_core.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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;