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: 982752 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6H5f9NA001930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 17 Jul 2011 05:41:30 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p6H5e4Ck011155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 17 Jul 2011 00:40:04 -0500 Received: from linux.omap.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep33.itg.ti.com (8.13.7/8.13.8) with ESMTP id p6H5e36g008571; Sun, 17 Jul 2011 00:40:03 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 658A880627; Sun, 17 Jul 2011 00:40:03 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 8409C80626 for ; Sun, 17 Jul 2011 00:40:01 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id p6H5e1PR008045 for ; Sun, 17 Jul 2011 00:40:01 -0500 (CDT) Received: from psmtp.com (na3sys009amx200.postini.com [74.125.149.236]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id p6H5e03Q011397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 17 Jul 2011 00:40:00 -0500 Received: from smtp-out.google.com ([172.24.198.13]) (using TLSv1) by na3sys009amx200.postini.com ([74.125.148.10]) with SMTP; Sun, 17 Jul 2011 05:40:01 GMT 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-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:64.68071/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [35/1] Cc: Todd Poynor , linux-arm-kernel@lists.infradead.org X-BeenThere: davinci-linux-open-source@linux.davincidsp.com 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: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 17 Jul 2011 05:41:30 +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;