lkml.org 
[lkml]   [2010]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Check kmalloc return value before use the buffer
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


\
 
 \ /
  Last update: 2010-05-07 11:53    [W:0.064 / U:1.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site