From patchwork Sun Jul 17 05:39:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 982742 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6H5ek3H001894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 17 Jul 2011 05:41:08 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QiK5h-0000PU-F0; Sun, 17 Jul 2011 05:40:33 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QiK5h-0005VM-2x; Sun, 17 Jul 2011 05:40:33 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QiK5d-0005VH-L4 for linux-arm-kernel@canuck.infradead.org; Sun, 17 Jul 2011 05:40:30 +0000 Received: from smtp-out.google.com ([216.239.44.51]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QiK5Y-0000dn-MU for linux-arm-kernel@lists.infradead.org; Sun, 17 Jul 2011 05:40:26 +0000 Received: from hpaq1.eem.corp.google.com (hpaq1.eem.corp.google.com [172.25.149.1]) by smtp-out.google.com with ESMTP id p6H5duEA020329; Sat, 16 Jul 2011 22:39:57 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1310881199; bh=e+xFGHgcpyPN6I03E5A2AD31lgI=; h=From:To:Cc:Subject:Date:Message-Id; b=azlXYYSIy0U0yFzZTJvyUtqVs7TemOdh4yCWtGG3sdRdagptdptyM2mZDjynZqtg+ 3bviYfHjcKd0A36jSnFCw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer; b=qtl14iKNtf12ubR0yQBgIGGO0piJru0BO4NS2t5usaYMBUEHxhRsk4/qXiquEXXGn hjlhv7bzzEzAqN8/4zvAg== Received: from conslugarocko.mtv.corp.google.com (conslugarocko.mtv.corp.google.com [172.18.102.26]) by hpaq1.eem.corp.google.com with ESMTP id p6H5dstc022849; Sat, 16 Jul 2011 22:39:55 -0700 Received: by conslugarocko.mtv.corp.google.com (Postfix, from userid 115684) id 8633323433A; Sat, 16 Jul 2011 22:39:54 -0700 (PDT) From: Todd Poynor To: Subject: [PATCH v2] ARM: davinci: Check for NULL return from irq_alloc_generic_chip Date: Sat, 16 Jul 2011 22:39:35 -0700 Message-Id: <1310881175-26182-1-git-send-email-toddpoynor@google.com> X-Mailer: git-send-email 1.7.3.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110717_064025_051584_059294F0 X-CRM114-Status: GOOD ( 10.33 ) X-Spam-Score: -4.5 (----) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-4.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [216.239.44.51 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.9 FRT_TODAY2 BODY: ReplaceTags: Today (2) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: khilman@ti.com, Todd Poynor , Sekhar Nori , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 17 Jul 2011 05:41:08 +0000 (UTC) Avoid NULL dereference of irq_alloc_generic_chip return in low memory conditions. Signed-off-by: Todd Poynor --- Found by inspection of the source; have not witnessed an actual crash. arch/arm/mach-davinci/irq.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c index d8c1af0..952dc12 100644 --- a/arch/arm/mach-davinci/irq.c +++ b/arch/arm/mach-davinci/irq.c @@ -52,6 +52,12 @@ davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num) struct irq_chip_type *ct; gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq); + if (!gc) { + pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n", + __func__, irq_start); + return; + } + ct = gc->chip_types; ct->chip.irq_ack = irq_gc_ack_set_bit; ct->chip.irq_mask = irq_gc_mask_clr_bit;