Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751879AbbGLXLU (ORCPT ); Sun, 12 Jul 2015 19:11:20 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:33740 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbbGLXLQ (ORCPT ); Sun, 12 Jul 2015 19:11:16 -0400 Subject: [PATCH 3/9] MIPS: VPE: Exit vpe_release() early if vpe_run() isn't defined To: Ralf Baechle From: Bjorn Helgaas Cc: Andrew Bresticker , linux-mips@linux-mips.org, James Hogan , linux-kernel@vger.kernel.org Date: Sun, 12 Jul 2015 18:11:12 -0500 Message-ID: <20150712231112.11177.382.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150712230402.11177.11848.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150712230402.11177.11848.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1268 Lines: 41 vpe_run() is a weak symbol. If there's no definition of it, its value is zero. If vpe_run is zero, return failure early. We're going to fail anyway, so there's no point in getting a VPE and attempting to load it. Signed-off-by: Bjorn Helgaas --- arch/mips/kernel/vpe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 11da314..72cae9f 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c @@ -821,13 +821,18 @@ static int vpe_release(struct inode *inode, struct file *filp) Elf_Ehdr *hdr; int ret = 0; + if (!vpe_run) { + pr_warn("VPE loader: ELF load failed.\n"); + return -ENOEXEC; + } + v = get_vpe(aprp_cpu_index()); if (v == NULL) return -ENODEV; hdr = (Elf_Ehdr *) v->pbuffer; if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) { - if ((vpe_elfload(v) >= 0) && vpe_run) { + if (vpe_elfload(v) >= 0) { vpe_run(v); } else { pr_warn("VPE loader: ELF load failed.\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/