Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755657Ab0G1QxK (ORCPT ); Wed, 28 Jul 2010 12:53:10 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:48502 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175Ab0G1QxI convert rfc822-to-8bit (ORCPT ); Wed, 28 Jul 2010 12:53:08 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=LdwAqCTjmExwuq4h9NTvhDR6/d+CN6Hi3KjKSNdOPrqzfBaDTN+6nYzmOhSGQzYDPw SOBn4EWfcEG7ie5KbHOfJZmOBdbguxvPzytredEUWYvYymXjHP4QBjjquUNGXu8X7IR3 V+ylqasqKnEF1+pO9Q/XyXsXuUGoyyhqJ9rqY= 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 X-Google-Sender-Auth: YK1LCYzMJpDXH-XGVY3L3d7MdP4 Message-ID: Subject: Re: [PATCH 05/10] mm: check kmalloc() return value From: Pekka Enberg 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 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1420 Lines: 42 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 > --- > ?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: email@kvack.org > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/