diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-08-09 20:19:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:45:03 -0400 |
commit | 51980ac9e72fb5f22c81b7798d65b691125d70ee (patch) | |
tree | fc12938848882bd76f7420f28d723056d9e5518e /mm/vmalloc.c | |
parent | cc8e970c3ce4d98afa8eb02dbd2526ce57f7611a (diff) |
mm/vmalloc.c: check kmalloc() return value
kmalloc() may fail, if so return -ENOMEM.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 8b5e4370540b..918c51335d64 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file) | |||
2437 | unsigned int *ptr = NULL; | 2437 | unsigned int *ptr = NULL; |
2438 | int ret; | 2438 | int ret; |
2439 | 2439 | ||
2440 | if (NUMA_BUILD) | 2440 | if (NUMA_BUILD) { |
2441 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); | 2441 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); |
2442 | if (ptr == NULL) | ||
2443 | return -ENOMEM; | ||
2444 | } | ||
2442 | ret = seq_open(file, &vmalloc_op); | 2445 | ret = seq_open(file, &vmalloc_op); |
2443 | if (!ret) { | 2446 | if (!ret) { |
2444 | struct seq_file *m = file->private_data; | 2447 | struct seq_file *m = file->private_data; |