From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666Ab0EHI4t (ORCPT ); Sat, 8 May 2010 04:56:49 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:41982 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362Ab0EHI4s convert rfc822-to-8bit (ORCPT ); Sat, 8 May 2010 04:56:48 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=txd/bDHrkSddWldoGKL/H9ALC7FEdFbL28xvGLON/uTEaQb5EdIFmpS0ZCndgUH6/3 n9+yFsSb5GU5gXcKdpwgZUQxRjwpXJ5s7aMJBGTSNQ/KHdlT3kVNn3bJFleWP0pSrR/U 18n6r+Je9AyHKkEQeA3Lm5pYEjPJwIDFMJw6Y= MIME-Version: 1.0 In-Reply-To: <4BE4BDED.5050406@tuxonice.net> References: <4BE3DF5A.9070601@tuxonice.net> <4BE4BDED.5050406@tuxonice.net> Date: Sat, 8 May 2010 16:56:47 +0800 Message-ID: Subject: Re: [PATCH] Check kmalloc return value before use the buffer From: Steven Liu To: Nigel Cunningham Cc: Linus WALLEIJ , "linux-kernel@vger.kernel.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 [Linus WALLEIJ] can this patch fix in? 2010/5/8 Nigel Cunningham : > Hi again. > > On 08/05/10 04:57, Linus WALLEIJ wrote: >> >> [Steven] >> >>> 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 >> >> Ha, I also misread tx for rx, sorry. > > I've just looked again, and the original version did have rx in the test. We > weren't seeing things :) > >> Acked-by: Linus Walleij > > Acked-by: Nigel Cunningham > > Regards, > > Nigel >