From patchwork Thu May 6 02:42:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wzt wzt X-Patchwork-Id: 97254 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o462YDss018180 for ; Thu, 6 May 2010 02:34:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754564Ab0EFCeN (ORCPT ); Wed, 5 May 2010 22:34:13 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:37566 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754031Ab0EFCeM (ORCPT ); Wed, 5 May 2010 22:34:12 -0400 Received: by pwi5 with SMTP id 5so1037322pwi.19 for ; Wed, 05 May 2010 19:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=XZzG7i63RDblnCJSRxOcxl3dSyLqTAmQDNMMkbqLhR4=; b=OwaHwO8wy8AZJPg955NbTLWfsakAG0VhzCZY3wTWzYdzQwO5J9cuQq7C5tY0KZe/Hj bjPiEeDgaiGSnUfbMMlAyQVGtYkJaFjsQwwXjLVHiDRyoGJyH49CjVI6K80sJWlPFkwN imjXDvIgrmPUT08LVAaJMvd2gS6HKwFO+fL78= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=BK32y++tl68+6pMTTlltllFPqyaBZu7mWGjhk/QF/bcrgyys1DRfNHnYwGGacdMHq+ sVLAZ3LZkoX72n8b7+gDmmJl9r+FV2HINSZSsqX2X16tWakpb9bk8W/aLzXBjRJDm7QF fap1mz8MaI/AgQL3/i5gVueKKSFs/cjPEhL+Q= Received: by 10.114.186.21 with SMTP id j21mr355527waf.71.1273113251380; Wed, 05 May 2010 19:34:11 -0700 (PDT) Received: from localhost ([121.0.29.239]) by mx.google.com with ESMTPS id d16sm2044507wam.0.2010.05.05.19.34.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 05 May 2010 19:34:10 -0700 (PDT) Date: Thu, 6 May 2010 10:42:08 +0800 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 Message-ID: <20100506024208.GB15956@localhost.localdomain> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 06 May 2010 02:34:13 +0000 (UTC) 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);