linux-mips
[Top] [All Lists]

[PATCH] MT-VPE : Fix the usage of kmalloc

To: linux-mips@linux-mips.org
Subject: [PATCH] MT-VPE : Fix the usage of kmalloc
From: "tiejun.chen" <tiejun.chen@windriver.com>
Date: Thu, 13 Mar 2008 13:38:36 +0800
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.12 (X11/20080227)
The return value of kmalloc() should be check, otherwise it is potential
risk.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 vpe.c |    4 ++++
 1 file changed, 4 insertions(+)


diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index c06eb81..35767de 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -885,6 +885,10 @@ static int vpe_elfload(struct vpe * v)
        }
 
        v->load_addr = alloc_progmem(mod.core_size);
+#ifndef CONFIG_MIPS_VPE_LOADER_TOM
+       if (!(v->load_addr))
+               return -ENOMEM;
+#endif
        memset(v->load_addr, 0, mod.core_size);
 
        printk("VPE loader: loading to %p\n", v->load_addr);

<Prev in Thread] Current Thread [Next in Thread>