lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CEE6BB42CAD6E947908279175AF8470A025A68CE5C@EXDCVYMBSTM006.EQ1STM.local>
Date:	Fri, 7 May 2010 08:52:12 +0200
From:	Linus WALLEIJ <linus.walleij@...ricsson.com>
To:	Steven Liu <lingjiujianke@...il.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] Check kmalloc return value before use the buffer

Hi Liu,

> Hi,linus.walleij
> 
>           Check kmalloc return value before use the buffer
> 
> 
> Signed-off-by: LiuQi <lingjiujianke@...il.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 962f9de..4f2af7c 100644
> --- a/arch/arm/mach-u300/dummyspichip.c
> +++ b/arch/arm/mach-u300/dummyspichip.c
> @@ -63,6 +63,11 @@ static ssize_t dummy_looptest(struct device *dev,
>  		goto out;
>  	}
>  	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
> +	if (bigtxbuf_virtual == NULL) {
> +		status = -ENOMEM;
> +		kfree(bigtxbuf_virtual);

kfree():ing NULL is OK, but you just checked it to be NULL so why?

> +		goto out;
> +	}
> 
>  	/* Fill TXBUF with some happy pattern */
>  	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);

Otherwise the bug it fixes is good to fix.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ