From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756338Ab0EGJvo (ORCPT ); Fri, 7 May 2010 05:51:44 -0400 Received: from crca.org.au ([74.207.252.120]:32974 "EHLO crca.org.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755957Ab0EGJvn (ORCPT ); Fri, 7 May 2010 05:51:43 -0400 X-Bogosity: Ham, spamicity=0.000002 Message-ID: <4BE3E2AB.9030107@tuxonice.net> Date: Fri, 07 May 2010 19:51:39 +1000 From: Nigel Cunningham User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: Steven Liu CC: Linus WALLEIJ , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] Check kmalloc return value before use the buffer References: <4BE3DF5A.9070601@tuxonice.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi. On 07/05/10 19:47, Steven Liu wrote: > Hi, guy, > > the code in arch/arm/mach-u300/dummyspichip.c is > > bigtxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL); > if (bigtxbuf_virtual == NULL) { > status = -ENOMEM; > goto out; > } > bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL); > > > if kmalloc memory space for bigrxbuf_virtual is NULL, when it have > kmalloc DMA_TEST_SIZE memory space for bigtxbuf_virtual,so ,if kmalloc > memory for bigtxbuf_virtual success and kmalloc memory for > bigrxbuf_virtual faild,i think we must kfree bigtxbuf_virtual memory Ah, I see. I misread. Humble apologies :) The other point still applies: You need to add a commit comment - even a simple one. Regards, Nigel