[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTikYvtfMgpXW5mGHmMDSoj9O0QKOMzspoDQHURxF@mail.gmail.com>
Date: Tue, 18 May 2010 13:23:01 +0800
From: Steven Liu <lingjiujianke@...il.com>
To: mpm@...enic.com, linux-kernel@...r.kernel.org
Subject: [PATCH] random: Check kmalloc return value and give the failed
message
Hi, Matt Mackall,
Check kmalloc return value and give the failed message
Signed-off-by: Liu Qi <lingjiujianke@...il.com>
---
drivers/char/random.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2fd3d39..d1bedeb 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -952,8 +952,11 @@ static void init_std_data(struct entropy_store *r)
mix_pool_bytes(r, &now, sizeof(now));
mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
/* Enable continuous test in fips mode */
- if (fips_enabled)
+ if (fips_enabled){
r->last_data = kmalloc(EXTRACT_SIZE, GFP_KERNEL);
+ if(r->last_data == NULL)
+ printk(KERN_ERR "kmalloc memory failed in %s \n", __func__);
+ }
}
static int rand_initialize(void)
--
1.7.1
Best regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists