Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: linux-mips@linux-mips.org
Subject: [PATCH] MT-VPE : Fix the usage of kmalloc
Date: Thu, 13 Mar 2008 13:38:36 +0800	[thread overview]
Message-ID: <47D8BDDC.9010607@windriver.com> (raw)

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);

             reply	other threads:[~2008-03-13  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  5:38 tiejun.chen [this message]
2008-03-13 15:15 ` [PATCH] MT-VPE : Fix the usage of kmalloc Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47D8BDDC.9010607@windriver.com \
    --to=tiejun.chen@windriver.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox