Messages in this thread Patch in this message | | | Date | Fri, 7 May 2010 17:05:44 +0800 | Subject | [PATCH] Check kmalloc return value before use the buffer | From | Steven Liu <> |
| |
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
| |