* [PATCH] Check kmalloc return value before use the bigrxbuf_virtual and kfree the bigtxbuf_virtual
@ 2010-05-07 10:04 Steven Liu
2010-05-07 10:36 ` Nigel Cunningham
0 siblings, 1 reply; 2+ messages in thread
From: Steven Liu @ 2010-05-07 10:04 UTC (permalink / raw)
To: Nigel Cunningham, Linus WALLEIJ, lgy123616 sadas, linux-kernel
Check kmalloc return value before use the bigrxbuf_virtual ,when
bigrxbuf_virtual is NULL, kfree bigtxbuf_virtual and out
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);
+ goto out;
+ }
/* Fill TXBUF with some happy pattern */
memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
--
1.6.0.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Check kmalloc return value before use the bigrxbuf_virtual and kfree the bigtxbuf_virtual
2010-05-07 10:04 [PATCH] Check kmalloc return value before use the bigrxbuf_virtual and kfree the bigtxbuf_virtual Steven Liu
@ 2010-05-07 10:36 ` Nigel Cunningham
0 siblings, 0 replies; 2+ messages in thread
From: Nigel Cunningham @ 2010-05-07 10:36 UTC (permalink / raw)
To: Steven Liu; +Cc: Linus WALLEIJ, linux-kernel
Hi.
On 07/05/10 20:04, Steven Liu wrote:
> Check kmalloc return value before use the bigrxbuf_virtual ,when
> bigrxbuf_virtual is NULL, kfree bigtxbuf_virtual and out
>
> Signed-off-by: LiuQi<lingjiujianke@gmail.com>
Acked-by: Nigel Cunningham <nigel@tuxonice.net>
> ---
> 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);
> + goto out;
> + }
>
> /* Fill TXBUF with some happy pattern */
> memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-07 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 10:04 [PATCH] Check kmalloc return value before use the bigrxbuf_virtual and kfree the bigtxbuf_virtual Steven Liu
2010-05-07 10:36 ` Nigel Cunningham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox