2010-07-16 16:13:36

by Kulikov Vasiliy

[permalink] [raw]
Subject: [PATCH 03/15] arch/tile: check kmalloc() result

If kmalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <[email protected]>
---
arch/tile/kernel/hardwall.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index 7bf0627..584b965 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -364,6 +364,8 @@ static struct hardwall_info *hardwall_create(
/* Allocate a new rectangle optimistically. */
rect = kmalloc(sizeof(struct hardwall_info),
GFP_KERNEL | __GFP_ZERO);
+ if (rect == NULL)
+ return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&rect->task_head);

/* Compute the rectangle size and validate that it's plausible. */
--
1.7.0.4