lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] cris:Check kmalloc return value before use data
From
Check kmalloc return value before use data

Signed-off-by: Liu Qi <lingjiujianke@gmail.com>
---
arch/cris/arch-v32/kernel/signal.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/cris/arch-v32/kernel/signal.c
b/arch/cris/arch-v32/kernel/signal.c
index 0b7e3f1..dd69fb4 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -656,6 +656,9 @@ int __init
cris_init_signal(void)
{
u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if(!data){
+ printk(KERN_ERR "kmalloc memory failed in %s \n", __func__);
+ return -ENOMEM;
+ }

/* This is movu.w __NR_sigreturn, r9; break 13; */
data[0] = 0x9c5f;
--
1.7.1

\
 
 \ /
  Last update: 2010-05-18 08:27    [W:0.034 / U:7.952 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site