Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1182452 > unrolled thread

[PATCH 3/9] MIPS: VPE: Exit vpe_release() early if vpe_run() isn't defined

Started byBjorn Helgaas <bhelgaas@google.com>
First post2015-07-13 01:20 +0200
Last post2015-07-13 01:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/9] MIPS: VPE: Exit vpe_release() early if vpe_run() isn't  defined Bjorn Helgaas <bhelgaas@google.com> - 2015-07-13 01:20 +0200

#1182452 — [PATCH 3/9] MIPS: VPE: Exit vpe_release() early if vpe_run() isn't defined

FromBjorn Helgaas <bhelgaas@google.com>
Date2015-07-13 01:20 +0200
Subject[PATCH 3/9] MIPS: VPE: Exit vpe_release() early if vpe_run() isn't defined
Message-ID<pLyHn-5YP-21@gated-at.bofh.it>
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 <bhelgaas@google.com>
---
 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/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web