From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail137.messagelabs.com (mail137.messagelabs.com [216.82.249.19]) by kanga.kvack.org (Postfix) with SMTP id 483836B02A8 for ; Wed, 28 Jul 2010 12:53:08 -0400 (EDT) Received: by bwz9 with SMTP id 9so4963417bwz.14 for ; Wed, 28 Jul 2010 09:53:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1280335203-23305-1-git-send-email-segooon@gmail.com> References: <1280335203-23305-1-git-send-email-segooon@gmail.com> Date: Wed, 28 Jul 2010 19:53:06 +0300 Message-ID: Subject: Re: [PATCH 05/10] mm: check kmalloc() return value From: Pekka Enberg Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org To: Kulikov Vasiliy Cc: kernel-janitors@vger.kernel.org, Andrew Morton , Tejun Heo , KAMEZAWA Hiroyuki , Nick Piggin , Jan Beulich , linux-kernel@vger.kernel.org, linux-mm@kvack.org List-ID: On Wed, Jul 28, 2010 at 7:40 PM, Kulikov Vasiliy wrote: > kmalloc() may fail, if so return -ENOMEM. > > Signed-off-by: Kulikov Vasiliy Acked-by: Pekka Enberg > --- > =A0mm/vmalloc.c | =A0 =A05 ++++- > =A01 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, struc= t file *file) > =A0 =A0 =A0 =A0unsigned int *ptr =3D NULL; > =A0 =A0 =A0 =A0int ret; > > - =A0 =A0 =A0 if (NUMA_BUILD) > + =A0 =A0 =A0 if (NUMA_BUILD) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ptr =3D kmalloc(nr_node_ids * sizeof(unsig= ned int), GFP_KERNEL); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ptr =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -ENOMEM; > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0ret =3D seq_open(file, &vmalloc_op); > =A0 =A0 =A0 =A0if (!ret) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct seq_file *m =3D file->private_data; > -- > 1.7.0.4 > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. =A0For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org > -- 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: email@kvack.org