From: wzt.wzt@gmail.com
To: linux-kernel@vger.kernel.org
Cc: linux-parisc@vger.kernel.org, kyle@mcmartin.ca, deller@gmx.de,
jejb@parisc-linux.org
Subject: [PATCH] Parisc: Check kmalloc return value before use the buffer in ccio-dma.c
Date: Thu, 6 May 2010 10:42:08 +0800 [thread overview]
Message-ID: <20100506024208.GB15956@localhost.localdomain> (raw)
Check kmalloc return value before use the buffer.
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
---
drivers/parisc/ccio-dma.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index f511e70..f465417 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1407,6 +1407,11 @@ static void __init ccio_init_resources(struct ioc *ioc)
struct resource *res = ioc->mmio_region;
char *name = kmalloc(14, GFP_KERNEL);
+ if (!name) {
+ printk(KERN_ERR "%s() failed to get enough memory\n", __func__);
+ return ;
+ }
+
snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path);
ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low);
--
1.6.5.3
next reply other threads:[~2010-05-06 2:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 2:42 wzt.wzt [this message]
2010-05-06 4:03 ` Kyle McMartin
2010-05-06 10:59 ` Matthew Wilcox
2010-05-06 20:08 ` Kyle McMartin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100506024208.GB15956@localhost.localdomain \
--to=wzt.wzt@gmail.com \
--cc=deller@gmx.de \
--cc=jejb@parisc-linux.org \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®