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.

No commit comment?

On 07/05/10 17:17, Steven Liu wrote:
> Signed-off-by: LiuQi<lingjiujianke@gmail.com>
> ---
> arch/arm/mach-u300/dummyspichip.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-u300/dummyspichip.c
> b/arch/arm/mach-u300/dummyspichip.c
> index 5f55012..df19f9b 100644
> --- a/arch/arm/mach-u300/dummyspichip.c
> +++ b/arch/arm/mach-u300/dummyspichip.c
> @@ -64,6 +64,11 @@ static ssize_t dummy_looptest(struct device *dev,
> goto out;
> }
> bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
> + if (bigrxbuf_virtual == NULL) {
> + status = -ENOMEM;
> + kfree(bigtxbuf_virtual);

Why kfree something you know is NULL?

Regards,

Nigel


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