linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 05/10] mm: check kmalloc() return value
@ 2010-07-28 16:40 Kulikov Vasiliy
  2010-07-28 16:53 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-07-28 16:40 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Andrew Morton, Tejun Heo, KAMEZAWA Hiroyuki, Nick Piggin,
	Jan Beulich, linux-kernel, linux-mm

kmalloc() may fail, if so return -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 mm/vmalloc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b7e314b..f63684a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file)
 	unsigned int *ptr = NULL;
 	int ret;
 
-	if (NUMA_BUILD)
+	if (NUMA_BUILD) {
 		ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
+		if (ptr == NULL)
+			return -ENOMEM;
+	}
 	ret = seq_open(file, &vmalloc_op);
 	if (!ret) {
 		struct seq_file *m = file->private_data;
-- 
1.7.0.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 05/10] mm: check kmalloc() return value
  2010-07-28 16:40 [PATCH 05/10] mm: check kmalloc() return value Kulikov Vasiliy
@ 2010-07-28 16:53 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2010-07-28 16:53 UTC (permalink / raw)
  To: Kulikov Vasiliy
  Cc: kernel-janitors, Andrew Morton, Tejun Heo, KAMEZAWA Hiroyuki,
	Nick Piggin, Jan Beulich, linux-kernel, linux-mm

On Wed, Jul 28, 2010 at 7:40 PM, Kulikov Vasiliy <segooon@gmail.com> wrote:
> kmalloc() may fail, if so return -ENOMEM.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

> ---
>  mm/vmalloc.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index b7e314b..f63684a 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file)
>        unsigned int *ptr = NULL;
>        int ret;
>
> -       if (NUMA_BUILD)
> +       if (NUMA_BUILD) {
>                ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
> +               if (ptr == NULL)
> +                       return -ENOMEM;
> +       }
>        ret = seq_open(file, &vmalloc_op);
>        if (!ret) {
>                struct seq_file *m = file->private_data;
> --
> 1.7.0.4
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-28 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28 16:40 [PATCH 05/10] mm: check kmalloc() return value Kulikov Vasiliy
2010-07-28 16:53 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).