Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2248479ybb; Fri, 27 Mar 2020 01:51:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvia1z3nTia3+CefYS8SOIit0BVOHCtUEjoKp6Vla9J+FcKuS5Eg6MH5zBZ2U1NZemtmntQ X-Received: by 2002:a4a:d258:: with SMTP id e24mr8352301oos.93.1585299118929; Fri, 27 Mar 2020 01:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585299118; cv=none; d=google.com; s=arc-20160816; b=qO6edrEEIovcRnxRdqEItNTYza6+YxFw53gxxMcDvR7px8xnztkmOaTjJd19O3B++z NKB2nj/O8SN9+m7QUYrexripM/fLM6iM33T65i3Ygu4lYFXYsD0J3dvEJJm3G8JCT2Fa igiHx36fpGv9dp+GCH4BuljLp/nUrWLfvrVrue3hLSH5tcJ4ZVfiq0pXO2HKs6jHUARe x2TSQhIP8TwVbi+EJk2azPfYcjpnAxdY5alD1Q+rm6V065Ax4pL/Zj0Aw2lyaVllUU1D V1so5G5iUf43nnR8vcHIqvy0k7GztlmKp74UEliyj1pcOSeXw/hXZh5N2fKScMMO/mXC bwtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=SN/jDLRWylESkAt6QMekC/Tpe7ewfTl4FIMoaHWoEeE=; b=KJioJ03FvY6/65TZFmCN+M2vH7f9gPW4IckTQKe2tnp8dNgJCSXatToI1heUNKLAhB Pgt8j/QjAm+bPX2qY+XGwJP4jjh4RvIedax3iDkxIlYOwZ3H0RdfmXWW76He/R2tyDqP uxBtmmkTd7aewiQmMEgSbhStUFKdkgrKziECTqUlQxB6P3/7z+Emp7M/hrG6RQ2hLnBY SG8ZwN2YHHXgtyfYf1RJW+8OS3uK3Vdz16e4rOh6rOT0nMKDirXm3Hzn7Id2lTGaMreh ZvmFkR/jfvizn0wZ4as0yjacyztqiCC1xXwc1HpRGkIN1A9jMg75G29GQShkKquHgj5B A3/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=cb1Ymu+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a128si2227016oif.202.2020.03.27.01.51.46; Fri, 27 Mar 2020 01:51:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=cb1Ymu+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbgC0IuP (ORCPT + 99 others); Fri, 27 Mar 2020 04:50:15 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:57286 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726169AbgC0IuO (ORCPT ); Fri, 27 Mar 2020 04:50:14 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 5860A27E039A; Fri, 27 Mar 2020 09:50:13 +0100 (CET) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FpmscZvK2U_Z; Fri, 27 Mar 2020 09:50:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id CB6CC27E0AEB; Fri, 27 Mar 2020 09:50:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu CB6CC27E0AEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1585299012; bh=SN/jDLRWylESkAt6QMekC/Tpe7ewfTl4FIMoaHWoEeE=; h=From:To:Date:Message-Id; b=cb1Ymu+VokqUrg5PAArt3L1fVzMSjaS8q1pFp8sQ05nvnbXNfsNMzoWTUAbeAWvc3 T/P28dcqbk3354ctudCjeii82CY8Td+j1cg/eCpWgvONCz0RYRSeUfYhJjTq1CU0SV p0aPmDnS+ZuITE0P0BxkugItjSRiYYTy36K90D00= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JMcNRfuSCV0B; Fri, 27 Mar 2020 09:50:12 +0100 (CET) Received: from triton.lin.mbt.kalray.eu (unknown [192.168.37.25]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id AF16827E039A; Fri, 27 Mar 2020 09:50:12 +0100 (CET) From: Clement Leger To: Ohad Ben-Cohen , Bjorn Andersson , Patrice Chotard , Maxime Coquelin , Alexandre Torgue Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Clement Leger Subject: [PATCH] remoteproc: remove rproc_elf32_sanity_check Date: Fri, 27 Mar 2020 09:49:39 +0100 Message-Id: <20200327084939.8321-1-cleger@kalray.eu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Clement Leger --- drivers/remoteproc/remoteproc_core.c | 2 +- drivers/remoteproc/remoteproc_elf_loader.c | 21 --------------------- drivers/remoteproc/remoteproc_internal.h | 1 - drivers/remoteproc/st_remoteproc.c | 2 +- drivers/remoteproc/st_slim_rproc.c | 2 +- drivers/remoteproc/stm32_rproc.c | 2 +- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index a9ac1d01e09b..02ff076b0122 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2069,7 +2069,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, 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; } diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c index 16e2c496fd45..29034f99898d 100644 --- a/drivers/remoteproc/remoteproc_elf_loader.c +++ b/drivers/remoteproc/remoteproc_elf_loader.c @@ -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 diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index b389dc79da81..31994715fd43 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -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); diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index a6cbfa452764..a3268d95a50e 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -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, }; diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c index 3cca8b65a8db..09bcb4d8b9e0 100644 --- a/drivers/remoteproc/st_slim_rproc.c +++ b/drivers/remoteproc/st_slim_rproc.c @@ -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, }; /** diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 6a66dbf2df40..2e07a95439c8 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -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, }; -- 2.17.1