public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check kmalloc return value before use the buffer
@ 2010-05-07  2:41 Steven Liu
  2010-05-07  6:52 ` Linus WALLEIJ
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Liu @ 2010-05-07  2:41 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-kernel

Hi,linus.walleij

          Check kmalloc return value before use the buffer


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 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);
+		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] 17+ messages in thread
* [PATCH] Check kmalloc return value before use the buffer
@ 2010-05-07  9:05 Steven Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Steven Liu @ 2010-05-07  9:05 UTC (permalink / raw)
  To: Linus WALLEIJ, linux-kernel

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] 17+ messages in thread

end of thread, other threads:[~2010-05-10 22:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07  2:41 [PATCH] Check kmalloc return value before use the buffer Steven Liu
2010-05-07  6:52 ` Linus WALLEIJ
2010-05-07  7:16   ` Steven Liu
2010-05-07  7:17   ` Steven Liu
2010-05-07  9:37     ` Nigel Cunningham
2010-05-07  9:37     ` Nigel Cunningham
2010-05-07  9:47       ` Steven Liu
2010-05-07  9:51         ` Nigel Cunningham
2010-05-07 18:57         ` Linus WALLEIJ
2010-05-08  1:27           ` Nigel Cunningham
2010-05-08  8:56             ` Steven Liu
2010-05-07  9:50       ` Steven Liu
2010-05-07  9:52         ` Nigel Cunningham
2010-05-07  9:55           ` Steven Liu
2010-05-10 21:49     ` Andy Isaacson
2010-05-10 22:08       ` Nigel Cunningham
  -- strict thread matches above, loose matches on Subject: below --
2010-05-07  9:05 Steven Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox